-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.ts
More file actions
52 lines (50 loc) · 1.31 KB
/
build.ts
File metadata and controls
52 lines (50 loc) · 1.31 KB
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
import { build, type BuildOptions, context, stop } from 'esbuild';
import manifest from './manifest.json' with { type: 'json' };
import { vue3Plugin } from 'esbuild-plugin-vue-iii';
const isProd = Deno.env.get('BUILD_MODE') === 'production';
const buildMode = isProd ? 'production' : 'development';
const logLevel = isProd ? 'warning' : 'debug';
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: [buildMode],
minify: isProd,
sourcemap: false,
treeShaking: true,
logLevel,
};
if (isProd) {
await build(buildOptions);
await stop();
} else {
const ctx = await context(buildOptions);
await ctx.watch();
}