-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathesbuild.config.js
55 lines (45 loc) · 1.27 KB
/
esbuild.config.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
48
49
50
51
52
53
54
55
const packageJson = require('./package.json')
const { createConfig, build, EXTERNAL_BASE } = require('../../build/esbuild/esbuild.config.base')
console.log(`building ${packageJson.name}`)
const external = [...EXTERNAL_BASE, 'electron-chrome-extensions/preload']
const browserConfig = createConfig({
entryPoints: ['src/index.ts'],
outfile: 'dist/cjs/index.js',
platform: 'node',
external,
})
const browserESMConfig = createConfig({
entryPoints: ['src/index.ts'],
outfile: 'dist/esm/index.mjs',
platform: 'node',
external,
format: 'esm',
})
build(browserConfig)
build(browserESMConfig)
const preloadConfig = createConfig({
entryPoints: ['src/preload.ts'],
outfile: 'dist/chrome-extension-api.preload.js',
platform: 'browser',
external,
sourcemap: false,
})
build(preloadConfig)
const browserActionPreloadConfig = createConfig({
entryPoints: ['src/browser-action.ts'],
outfile: 'dist/cjs/browser-action.js',
platform: 'browser',
format: 'cjs',
external,
sourcemap: false,
})
const browserActionESMPreloadConfig = createConfig({
entryPoints: ['src/browser-action.ts'],
outfile: 'dist/esm/browser-action.mjs',
platform: 'browser',
external,
sourcemap: false,
format: 'esm',
})
build(browserActionPreloadConfig)
build(browserActionESMPreloadConfig)