-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.shared.config.cjs
47 lines (46 loc) · 1.11 KB
/
webpack.shared.config.cjs
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
const { DefinePlugin } = require('webpack');
//const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
module.exports = (env) => ({
mode: env.production ? 'production' : 'development',
//devtool: 'inline-source-map',
resolve: {
extensions: ['.js', '.jsx', '...'],
mainFiles: ['index'],
},
module: {
rules: [
{
test: /\.(jsx?|cjs)$/,
exclude: /node_modules/,
resolve: {
fullySpecified: false,
},
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
['@babel/preset-react', { runtime: 'automatic' }],
],
},
},
{
test: /\.(txt|md)$/i,
type: 'asset/inline',
},
{
test: /\.html$/i,
loader: 'html-loader',
},
],
},
plugins: [
new DefinePlugin({
'process.env._DATA_HOST': env.production
? '"cdztt.cn"'
// ? '"124.223.92.23"'
: '"localhost"',
'process.env._DATA_PORT': env.localhostDev ? '"444"' : '"443"',
}),
//new BundleAnalyzerPlugin()
],
});