-
Notifications
You must be signed in to change notification settings - Fork 42
/
vite.config.ts
62 lines (61 loc) · 1.88 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
56
57
58
59
60
61
62
/// <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';
// To include and minify glsl into the bundle
import glsl from 'vite-plugin-glsl';
// To include css into the bundle
//import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
export default defineConfig({
build: {
minify: 'esbuild',
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'src/js/A.js'),
name: 'A',
formats: ["umd", "es"],
// the proper extensions will be added
fileName: 'aladin',
},
rollupOptions: {},
//formats: ["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(resolve(__dirname, 'src/core')),
topLevelAwait(),
glsl({
compress: true,
}),
],
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: ['core/pkg'],
// },
//},
server: {
open: '/examples/index.html',
},
});