shared webpack browser config: add WEBWORKER definition

This commit is contained in:
Martin Aeschlimann 2020-06-26 10:13:08 +02:00
parent d0a272d025
commit 94081f67b6
2 changed files with 5 additions and 5 deletions

View file

@ -8,20 +8,18 @@
'use strict';
const path = require('path');
const withBrowserDefaults = require('../shared.webpack.config').browser;
const webpack = require('webpack');
const config = withBrowserDefaults({
context: __dirname,
node: false,
entry: {
extension: './src/extension.ts',
extension: './src/extension.ts'
},
resolve: {
alias: {
'node-fetch': path.resolve(__dirname, 'node_modules/node-fetch/browser.js'),
},
'node-fetch': path.resolve(__dirname, 'node_modules/node-fetch/browser.js')
}
}
});
config.plugins.push(new webpack.DefinePlugin({ WEBWORKER: JSON.stringify(true) }))
module.exports = config;

View file

@ -13,6 +13,7 @@ const fs = require('fs');
const merge = require('merge-options');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { NLSBundlePlugin } = require('vscode-nls-dev/lib/webpack-bundler');
const { DefinePlugin } = require('webpack');
function withNodeDefaults(/**@type WebpackConfig*/extConfig) {
// Need to find the top-most `package.json` file
@ -129,6 +130,7 @@ function withBrowserDefaults(/**@type WebpackConfig*/extConfig) {
new CopyWebpackPlugin([
{ from: 'src', to: '.', ignore: ['**/test/**', '*.ts'] }
]),
new DefinePlugin({ WEBWORKER: JSON.stringify(true) })
]
};