This repository has been archived by the owner on Jul 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.combine.js
69 lines (67 loc) · 1.66 KB
/
webpack.combine.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const buildPath = `${__dirname}/dist`;
module.exports = {
mode: 'development',
target: 'web',
entry: {
app: ['index.js'],
},
output: {
filename: '[name].js',
chunkFilename: '[name].js',
},
resolve: {
extensions: ['.js'],
modules: [
`${__dirname}/src`,
'node_modules',
],
},
module: {
rules: [
{
test: /\.js$/,
include: `${__dirname}/src`,
use: [{
loader: 'babel-loader',
options: {
presets: ['env', 'react'],
plugins: ['transform-class-properties', 'syntax-dynamic-import',]
},
}]
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
]
}
],
},
serve: {
host: '0.0.0.0',
port: 3001,
hot: false,
},
optimization: {
splitChunks: {
cacheGroups: {
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true
}
}
}
},
plugins: [
new MiniCssExtractPlugin(),
new CopyWebpackPlugin([{
from: `${__dirname}/src/index-combine.html`,
to: `${buildPath}/index.html`
}])
],
};