Bundle jsoncparser with esbuild (#15116)
This commit is contained in:
Родитель
3b88c8bac5
Коммит
7ac3449f58
|
@ -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',
|
||||
|
@ -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,
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const constants = require('../constants');
|
||||
const common = require('./common');
|
||||
const entryItems = {
|
||||
// jsonc-parser does not get bundled propertly with esbuild.
|
||||
[`node_modules/jsonc-parser`]: `./node_modules/jsonc-parser`
|
||||
};
|
||||
|
||||
const config = {
|
||||
mode: 'production',
|
||||
target: 'node',
|
||||
context: constants.ExtensionRootDir,
|
||||
entry: entryItems,
|
||||
devtool: 'source-map',
|
||||
node: {
|
||||
__dirname: false
|
||||
},
|
||||
externals: ['vscode', 'commonjs', 'vscode-jsonrpc'],
|
||||
plugins: [...common.getDefaultPlugins('dependencies')],
|
||||
resolve: {
|
||||
extensions: ['.js']
|
||||
},
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
path: path.resolve(constants.ExtensionRootDir, 'dist'),
|
||||
libraryTarget: 'commonjs2',
|
||||
devtoolModuleFilenameTemplate: '../../[resource-path]'
|
||||
}
|
||||
};
|
||||
// tslint:disable-next-line:no-default-export
|
||||
exports.default = config;
|
|
@ -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');
|
||||
|
|
10
package.json
10
package.json
|
@ -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",
|
||||
|
|
Загрузка…
Ссылка в новой задаче