-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.common.js
45 lines (44 loc) · 1002 Bytes
/
webpack.common.js
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
import HTMLWebpackPlugin from 'html-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import path from 'path';
export default {
target: ['web', 'es2020'],
entry: path.resolve('./src/index.ts'),
output: {
filename: '[name].js',
path: path.resolve('./dist'),
clean: true,
},
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: 'css-loader',
},
],
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js', '.css'],
},
plugins: [
new HTMLWebpackPlugin({
filename: 'index.html',
template: path.resolve('./index.html'),
scriptLoading: 'module',
}),
new CopyWebpackPlugin({
patterns: [
{ from: path.resolve('./assets'), to: path.resolve('./dist/assets') },
{ from: path.resolve('./style'), to: path.resolve('./dist/style') },
],
options: {
concurrency: 50,
},
}),
],
};