-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.ts
51 lines (49 loc) · 1.25 KB
/
build.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
import { build, type BuildOptions, context, stop } from 'esbuild';
import manifest from './manifest.json' with { type: 'json' };
import { vue3Plugin } from 'esbuild-plugin-vue-iii';
const nodeEnv = Deno.env.get('NODE_ENV');
const isProd = nodeEnv === 'production';
const buildOptions: BuildOptions = {
plugins: [
vue3Plugin({
isProduction: isProd,
}),
],
entryPoints: [
'./src/jsdiff-devtools.ts',
'./src/jsdiff-panel.ts',
'./src/jsdiff-proxy.ts',
'./src/jsdiff-console.ts',
'./src/firefox/jsdiff-background.ts',
],
outdir: './public/build/',
publicPath: '/public/build/',
define: {
__VUE_OPTIONS_API__: 'false',
__VUE_PROD_DEVTOOLS__: 'false',
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false',
__development__: `${!isProd}`,
__app_version__: `"${manifest.version}"`,
__app_homepage__: `"${manifest.homepage_url}"`,
},
loader: {
'.png': 'file',
'.svg': 'file',
},
bundle: true,
platform: 'browser',
format: 'iife',
target: 'esnext',
conditions: [`${nodeEnv}`],
minify: isProd,
sourcemap: false,
treeShaking: true,
logLevel: 'warning',
};
if (isProd) {
await build(buildOptions);
await stop();
} else {
const ctx = await context(buildOptions);
await ctx.watch();
}