-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
55 lines (54 loc) · 1.63 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/// <reference types="vitest" />
import * as path from 'path'
import {resolve} from 'path'
import {defineConfig} from 'vite';
// For wasm inclusion
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
// For wasm generated by wasm-pack
import wasmPack from 'vite-plugin-wasm-pack';
export default defineConfig({
build: {
minify: 'esbuild',
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'pkg/wgpu_sky_rendering.js'),
name: 'wgpu_sky_rendering',
formats: ["umd", "es"],
// the proper extensions will be added
fileName: 'wgpu_sky_rendering',
},
//rollupOptions: {},
format: "es",
//target: ["es2015", "chrome58", "edge18", "firefox57", "node12", "safari11"],
//target: ["es2015"],
// Relative to the root
outDir: resolve(__dirname, 'dist'),
},
//publicDir: resolve(__dirname, 'src/img'),
plugins: [
wasm(),
wasmPack(__dirname),
topLevelAwait(),
],
resolve: {
alias: [
{find: '@', replacement: path.resolve(__dirname, '/src')},
{find: '#', replacement: path.resolve(__dirname, '/tests/unit')},
{find: '$', replacement: path.resolve(__dirname, '/tests/e2e')}
],
},
test: {
globals: true,
environment: 'happy-dom',
include: [
'tests/unit/**/*.{test,spec}.{js,ts}'
],
deps: {
inline: ['pkg'],
},
},
server: {
open: 'index.html',
},
});