-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
43 lines (41 loc) · 1.24 KB
/
webpack.config.js
File metadata and controls
43 lines (41 loc) · 1.24 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
const path = require('path');
const getMode = require('./webpack/mode');
const getPlugins = require('./webpack/plugins');
const getModules = require('./webpack/modules');
const getResolve = require('./webpack/resolve');
const getEntryFile = require('./webpack/entry');
const PUBLIC_PATH = require('./webpack/constants').PUBLIC_PATH;
const environment = process.env.NODE_ENV ? process.env.NODE_ENV : 'development';
const port = process.env.PORT ? process.env.PORT : 9001;
module.exports = () => {
return {
mode: getMode(environment),
entry: getEntryFile(),
output: {
filename: (() => {
if (environment === 'production' || environment === 'uat') {
return '[name].[hash].js';
} else {
return '[name].js';
}
})(),
chunkFilename: '[name].bundle.[hash].js',
path: path.resolve(__dirname, 'dist'),
publicPath: PUBLIC_PATH
},
devServer: {
contentBase: path.resolve(__dirname),
publicPath: PUBLIC_PATH,
port: port,
historyApiFallback: true,
host: 'localhost'
},
module: getModules(),
resolve: getResolve(),
plugins: getPlugins(environment),
watchOptions: {
ignored: ['node_modules', 'dist'],
poll: true
}
};
};