-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.bootstrap.config.js
47 lines (39 loc) · 1.35 KB
/
webpack.bootstrap.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
39
40
41
42
43
44
45
46
47
const fs = require('fs');
function getBootstraprcCustomLocation() {
return process.env.BOOTSTRAPRC_LOCATION;
}
const bootstraprcCustomLocation = getBootstraprcCustomLocation();
let defaultBootstraprcFileExists;
try {
fs.statSync('./.bootstraprc');
defaultBootstraprcFileExists = true;
} catch (e) {
defaultBootstraprcFileExists = false;
}
if (!bootstraprcCustomLocation && !defaultBootstraprcFileExists) {
/* eslint no-console: 0 */
console.log('You did not specify a \'bootstraprc-location\' ' +
'arg or a ./.boostraprc file in the root.');
console.log('Using the bootstrap-loader default configuration.');
}
// DEV and PROD have slightly different configurations
let bootstrapDevEntryPoint;
if (bootstraprcCustomLocation) {
bootstrapDevEntryPoint = 'bootstrap-loader/lib/bootstrap.loader?' +
`configFilePath=${__dirname}/${bootstraprcCustomLocation}` +
'!bootstrap-loader/no-op.js';
} else {
bootstrapDevEntryPoint = 'bootstrap-loader';
}
let bootstrapProdEntryPoint;
if (bootstraprcCustomLocation) {
bootstrapProdEntryPoint = 'bootstrap-loader/lib/bootstrap.loader?extractStyles' +
`&configFilePath=${__dirname}/${bootstraprcCustomLocation}` +
'!bootstrap-loader/no-op.js';
} else {
bootstrapProdEntryPoint = 'bootstrap-loader/extractStyles';
}
module.exports = {
dev: bootstrapDevEntryPoint,
prod: bootstrapProdEntryPoint,
};