-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.config.js
38 lines (27 loc) · 1.26 KB
/
webpack.config.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
// File: ./webpack.config.js
const webpackNodeUtils = require('webpack-node-utils');
// The directory where the configuration files are.
const directory = '.webpack';
// Use a environment variable to detect the target
// const target = process.env.BUILD_TARGET || 'frontend';
// Use the `NODE_ENV` environment variable to detect the build type.
const type = process.env.NODE_ENV === 'production' ? 'prod' : 'dev';
// And another environment variable to detect the variation
const variation = process.env.BUILD_AS_LIB === 'true' ? 'library' : '';
// Should the module add a timestamp hash on the parameters so I can use when creating the files?
const createHash = type === 'prod';
// Define some parameters you would need access on your configurations
const params = {
// HTMLTitle: 'Hello world!',
// outputDir: './dist/'
};
// Finally, get and export the configuration
// module.exports = webpackNodeUtils.config(directory, target, type, createHash, params, variation);
module.exports = () => {
const frontendConfig = webpackNodeUtils.config(directory, 'frontend', type, createHash, params, variation);
const backendConfig = webpackNodeUtils.config(directory, 'backend', type, createHash, params, variation);
return [
frontendConfig,
backendConfig
];
};