-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathwebpack.config.js
More file actions
77 lines (75 loc) · 2.02 KB
/
webpack.config.js
File metadata and controls
77 lines (75 loc) · 2.02 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
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
/*
* The folder structure of `dist` would be:
* dist/
* ├── terminal/
* │ ├── terminal.js
* │ └── terminal.html
* └── diffView/
* ├── diffView.js
* ├── diffView.html
* └── css/
* └── style.css
*/
module.exports = {
mode: 'production',
entry: {
// Add more entry points here
terminal: './src/terminal/index.ts',
diffView: './src/diffView/index.ts'
},
resolve: {
extensions: ['.ts', '.js']
},
output: {
filename: '[name]/[name].js',
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
/// MARK: - Terminal component files
{
from: 'src/terminal/terminal.html',
to: 'terminal/terminal.html'
},
/// MARK: - DiffView component files
{
from: 'src/diffView/diffView.html',
to: 'diffView/diffView.html'
},
{
from: 'src/diffView/css',
to: 'diffView/css'
}
]
}),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
})
],
optimization: {
minimizer: [
new TerserPlugin({
// Prevent extracting license comments to a separate file
extractComments: false
})
]
}
};