-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathwebpack.test.config.js
More file actions
87 lines (84 loc) · 2.13 KB
/
webpack.test.config.js
File metadata and controls
87 lines (84 loc) · 2.13 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//@ts-check
/** @typedef {import('webpack').Configuration} WebpackConfig **/
const webpack = require('webpack');
const { default: TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');
const path = require('path');
/**
* Webpack configuration for browser tests.
* Separated from main webpack.config.js to isolate test-only dependencies (assert, process polyfills).
*
* @type WebpackConfig
*/
const browserTestConfig = {
context: path.resolve(__dirname),
mode: 'development',
target: 'webworker',
entry: {
'test/suite/index': './test/browser/suite/index.ts',
},
output: {
path: path.resolve(__dirname, 'dist', 'browser'),
filename: '[name].js',
libraryTarget: 'commonjs',
devtoolModuleFilenameTemplate: '../../[resource-path]',
},
resolve: {
extensions: ['.ts', '.js'],
plugins: [new TsconfigPathsPlugin({})],
fallback: {
assert: require.resolve('assert'),
process: require.resolve('process/browser.js'),
},
},
module: {
parser: {
javascript: {
commonjsMagicComments: true,
},
},
rules: [
{
test: /\.ts$/,
include: path.resolve(__dirname, 'test'),
use: {
loader: 'ts-loader',
options: {
configFile: path.resolve(__dirname, 'test', 'tsconfig.json'),
},
},
},
{
test: /\.ts$/,
exclude: [/node_modules/, path.resolve(__dirname, 'test')],
use: {
loader: 'ts-loader',
options: {
projectReferences: true,
},
},
},
],
},
externals: {
vscode: 'commonjs vscode',
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser.js',
}),
new webpack.DefinePlugin({
'process.env.WEBPACK_MODE': true,
'process.env.DEBUG_DELAY': JSON.stringify(process.env.DEBUG_DELAY || '0'),
'process.env.WATCH_MODE': JSON.stringify(process.env.WATCH_MODE || ''),
}),
],
devtool: 'source-map',
node: {
__filename: 'eval-only',
__dirname: 'eval-only',
},
infrastructureLogging: {
level: 'log',
},
};
module.exports = browserTestConfig;