-
-
Notifications
You must be signed in to change notification settings - Fork 371
/
build-node.js
26 lines (26 loc) · 1.08 KB
/
build-node.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
require('esbuild').build({
entryPoints: ['./node_modules/typescript-vue-plugin/out/index.js'],
bundle: true,
outfile: './dist/index.js',
external: ['vscode'],
format: 'cjs',
platform: 'node',
tsconfig: '../../tsconfig.build.json',
minify: process.argv.includes('--minify'),
watch: process.argv.includes('--watch'),
plugins: [{
name: 'umd2esm',
setup(build) {
build.onResolve({ filter: /(vscode-.*|estree-walker|jsonc-parser)/ }, args => {
const pathUmdMay = require.resolve(args.path, { paths: [args.resolveDir] })
const pathEsm = pathUmdMay.replace('/umd/', '/esm/')
return { path: pathEsm }
})
build.onResolve({ filter: /\@vue\/compiler-sfc/ }, args => {
const pathUmdMay = require.resolve(args.path, { paths: [args.resolveDir] })
const pathEsm = pathUmdMay.replace('compiler-sfc.cjs.js', 'compiler-sfc.esm-browser.js')
return { path: pathEsm }
})
},
}],
}).catch(() => process.exit(1))