forked from vscode-icons/vscode-icons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
49 lines (47 loc) · 1.44 KB
/
webpack.config.ts
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* eslint-disable import/no-internal-modules */
import { resolve } from 'path';
import { Configuration } from 'webpack';
import { constants } from './out/src/constants';
const getConfig = (argv: any): Configuration => ({
context: resolve(__dirname, 'out'),
// development mode only
devtool: argv.mode === 'development' ? 'source-map' : false,
externals: {
// The vscode-module is created on-the-fly and must be excluded.
// Add other modules that cannot be webpack'ed.
// 📖 -> https://webpack.js.org/configuration/externals/
vscode: 'commonjs vscode',
},
mode: argv.mode,
node: {
__dirname: false,
__filename: false,
},
output: {
path: resolve(__dirname, 'dist/src'),
libraryTarget: 'commonjs2',
// development mode only
devtoolModuleFilenameTemplate:
argv.mode === 'development' ? '../../[resource-path]' : '',
},
target: 'node',
});
export default [
(
_env: string | Record<string, boolean | number | string>,
argv: any,
): Configuration => {
const config: Configuration = getConfig(argv);
config.output!.filename = constants.extension.distEntryFilename;
return config;
},
(
_env: string | Record<string, boolean | number | string>,
argv: any,
): Configuration => {
const config: Configuration = getConfig(argv);
config.entry = './src/uninstall.js';
config.output!.filename = constants.extension.uninstallEntryFilename;
return config;
},
];