From 6c8d41d92d4359fff89e946842898e2f8394033b Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Thu, 7 Nov 2024 02:51:08 +0800 Subject: [PATCH] chore(vscode): combine build actions --- extensions/vscode/scripts/build.js | 38 ++++-------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/extensions/vscode/scripts/build.js b/extensions/vscode/scripts/build.js index eafe5d17a1..1eb540f5ef 100644 --- a/extensions/vscode/scripts/build.js +++ b/extensions/vscode/scripts/build.js @@ -4,12 +4,13 @@ const fs = require('fs'); require('esbuild').context({ entryPoints: { - client: './out/nodeClientMain.js', - server: './node_modules/@vue/language-server/bin/vue-language-server.js', + 'dist/client': './out/nodeClientMain.js', + 'dist/server': './node_modules/@vue/language-server/bin/vue-language-server.js', + 'node_modules/typescript-vue-plugin-bundle/index': './node_modules/@vue/typescript-plugin/index.js', }, bundle: true, metafile: process.argv.includes('--metafile'), - outdir: './dist', + outdir: '.', external: ['vscode'], format: 'cjs', platform: 'node', @@ -62,34 +63,3 @@ require('esbuild').context({ console.log('finished.'); } }) - -require('esbuild').context({ - entryPoints: ['./node_modules/@vue/typescript-plugin/index.js'], - bundle: true, - outfile: './node_modules/typescript-vue-plugin-bundle/index.js', - external: ['vscode'], - format: 'cjs', - platform: 'node', - tsconfig: './tsconfig.json', - minify: process.argv.includes('--minify'), - plugins: [{ - name: 'umd2esm', - setup(build) { - build.onResolve({ filter: /^(vscode-.*-languageservice|jsonc-parser)/ }, args => { - const pathUmdMay = require.resolve(args.path, { paths: [args.resolveDir] }) - const pathEsm = pathUmdMay.replace('/umd/', '/esm/') - return { path: pathEsm } - }) - }, - }], -}).then(async ctx => { - console.log('building...'); - if (process.argv.includes('--watch')) { - await ctx.watch(); - console.log('watching...'); - } else { - await ctx.rebuild(); - await ctx.dispose(); - console.log('finished.'); - } -})