-
Notifications
You must be signed in to change notification settings - Fork 200
Expand file tree
/
Copy pathwebpack.config.js
More file actions
36 lines (33 loc) · 872 Bytes
/
webpack.config.js
File metadata and controls
36 lines (33 loc) · 872 Bytes
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
const merge = require('webpack-merge');
const testConfig = require('./webpack.config.test');
const developmentConfig = require('./webpack.config.development');
const productionConfig = require('./webpack.config.production');
const autoprefixer = require('autoprefixer');
const configForEnv = (env) => {
switch (env) {
case 'test':
return testConfig;
case 'development':
return developmentConfig;
case 'production':
return productionConfig;
default:
throw new TypeError(`Invalid environment given ${env}!`);
}
};
const baseConfig = {
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/,
}
]
},
resolve: {
extensions: ['', '.css', '.scss', '.js', '.json']
},
postcss: [autoprefixer]
};
module.exports = merge(baseConfig, configForEnv(process.env.NODE_ENV));