forked from microsoft/vscode-edge-devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
81 lines (79 loc) · 2.58 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
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
import copyPlugin from 'copy-webpack-plugin';
import path from 'path';
import { DefinePlugin } from 'webpack';
const commonConfig = {
devtool: 'source-map',
mode: 'development',
module: {
rules: [
{
exclude: /node_modules/,
test: /\.tsx?$/,
use: 'ts-loader',
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
};
module.exports = (env: any) => {
return [
{
...commonConfig,
entry: {
host: './src/host/mainHost.ts',
},
name: 'host',
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'out/host'),
},
},
{
...commonConfig,
entry: {
screencast: './src/screencast/main.ts',
},
name: 'screencast',
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'out/screencast'),
},
},
{
...commonConfig,
entry: {
extension: './src/extension.ts',
},
externals: {
vscode: 'commonjs vscode',
},
name: 'extension',
output: {
devtoolModuleFilenameTemplate: '../[resource-path]',
filename: '[name].js',
libraryTarget: 'commonjs2',
path: path.resolve(__dirname, 'out'),
},
stats: 'errors-only', // Bug ws package includes dev-dependencies which webpack will report as warnings
target: 'node',
// Copy startpage html to output bundle
plugins: [
new copyPlugin({
patterns: [
{ from: 'startpage', to: 'startpage'},
{ from: './src/common/styles.css', to: 'common/styles.css'},
{ from: 'icon.png', to: 'icon.png'},
{ from: 'src/screencast/view.css', to: 'screencast/view.css'},
],
}),
// These must also be defined in the jest section of package.json for tests to pass
new DefinePlugin({
DEBUG: JSON.stringify(env && env.debug || false),
DEVTOOLS_BASE_URI: JSON.stringify(env && env.devtoolsBaseUri || undefined),
})
],
},
]
};