-
Notifications
You must be signed in to change notification settings - Fork 13
/
vite.config.worker.js
47 lines (45 loc) · 1.09 KB
/
vite.config.worker.js
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
import path from 'path';
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
export default defineConfig(({ mode }) => {
const value = (dev, fallback) => (mode === 'development' ? dev : fallback);
return {
clearScreen: false,
define: {
'process.env.NODE_ENV': JSON.stringify(
value('development', 'production'),
),
},
build: {
emptyOutDir: false,
copyPublicDir: false,
minify: false,
outDir: value('public', 'dist'),
lib: {
entry: path.resolve(__dirname, 'src/worker-main.ts'),
name: 'worker',
formats: ['iife'],
fileName: () => value('worker-dev.js', 'worker.js'),
},
},
plugins: value(
[
viteStaticCopy({
targets: [
{
src: path.join(
__dirname,
'node_modules',
'x-img-diff-js',
'build',
'cv-wasm_browser.*',
),
dest: '.',
},
],
}),
],
[],
),
};
});