Skip to content

Commit

Permalink
Bundle jsoncparser with esbuild (#15116)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Feb 2, 2024
1 parent 3b88c8b commit 7ac3449
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 52 deletions.
7 changes: 3 additions & 4 deletions build/esbuild/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ const commonExternals = [
'commonjs',
'node:crypto',
'vscode-jsonrpc', // Used by a few modules, might as well pull this out, instead of duplicating it in separate bundles.
// jsonc-parser doesn't get bundled well with esbuild without any changes.
// Its possible the fix is very simple.
// For now, its handled with webpack.
'jsonc-parser',
// Ignore telemetry specific packages that are not required.
'applicationinsights-native-metrics',
'@opentelemetry/tracing',
Expand Down Expand Up @@ -171,6 +167,9 @@ function createConfig(
moment: path.join(extensionFolder, 'build', 'webpack', 'moment.js'),
'vscode-jupyter-release-version': path.join(__dirname, releaseVersionScriptFile)
};
if (target === 'desktop') {
alias['jsonc-parser'] = path.join(extensionFolder, 'node_modules', 'jsonc-parser', 'lib', 'esm', 'main.js');
}
return {
entryPoints: [source],
outfile,
Expand Down
35 changes: 0 additions & 35 deletions build/webpack/webpack.extension.dependencies.config.js

This file was deleted.

7 changes: 0 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,6 @@ async function buildWebPackForDevOrProduction(configFile, configNameForProductio
await spawnAsync('npm', ['run', 'webpack', '--', '--config', configFile, '--mode', 'development'], webpackEnv);
}
}
gulp.task('webpack-dependencies', async () => {
// No need to build dependencies for web.
if (common.getBundleConfiguration() === common.bundleConfiguration.web) {
return;
}
await buildWebPackForDevOrProduction('./build/webpack/webpack.extension.dependencies.config.js', 'production');
});

function modifyJson(jsonFile, cb) {
const json = fs.readFileSync(jsonFile).toString('utf-8');
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2094,17 +2094,15 @@
"preprePublishNonBundle": "gulp clean",
"updatePackageJsonForBundle": "gulp updatePackageJsonForBundle",
"prePublishNonBundle": "npm run compile-no-watch",
"compile": "concurrently \"tsc -watch -p ./\" npm:webpack-dev \"npx tsx build/esbuild/build.ts --watch\"",
"compile-watch-all": "concurrently \"tsc -watch -p ./\" npm:webpack-dev \"npx tsx build/esbuild/build.ts --watch-all\"",
"compile-no-watch": "concurrently npm:compile-out npm:webpack-dev npm:esbuild-all",
"compile": "concurrently \"tsc -watch -p ./\" \"npx tsx build/esbuild/build.ts --watch\"",
"compile-watch-all": "concurrently \"tsc -watch -p ./\" \"npx tsx build/esbuild/build.ts --watch-all\"",
"compile-no-watch": "concurrently npm:compile-out npm:esbuild-all",
"compile-out": "tsc -p ./",
"compile-web-test": "webpack --mode development --config ./build/webpack/webpack.extension.web.config.js",
"compile-web-test-watch": "webpack --mode development --config ./build/webpack/webpack.extension.web.config.js --stats-error-details --watch --progress",
"esbuild-all": "npx tsx build/esbuild/build.ts",
"compile-release": "concurrently npm:compile-out npm:esbuild-release npm:webpack-release",
"compile-release": "concurrently npm:compile-out npm:esbuild-release",
"esbuild-release": "npx tsx build/esbuild/build.ts --production",
"webpack-dev": "gulp webpack-dependencies",
"webpack-release": "gulp webpack-dependencies",
"esbuild-watch": "npx tsx build/esbuild/build.ts --watch",
"checkDependencies": "gulp checkDependencies",
"postinstall": "npm run download-api && node ./build/ci/postInstall.js",
Expand Down

0 comments on commit 7ac3449

Please sign in to comment.