-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.js
More file actions
30 lines (27 loc) · 765 Bytes
/
webpack.config.js
File metadata and controls
30 lines (27 loc) · 765 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
const Path = require('path');
const { CssWebpackConfig, JavascriptWebpackConfig } = require('@silverstripe/webpack-config');
const PATHS = {
ROOT: Path.resolve(),
};
const config = [
new JavascriptWebpackConfig('js', PATHS)
.setEntry({
bundle: `${PATHS.SRC}/bundles/bundle.js`
})
.mergeConfig({
output: {
path: PATHS.DIST,
filename: 'js/[name].js',
},
})
.getConfig(),
new CssWebpackConfig('css', PATHS)
.setEntry({
bundle: `${PATHS.SRC}/styles/bundle.scss`,
})
.getConfig(),
];
// Use WEBPACK_CHILD=js or WEBPACK_CHILD=css env var to run a single config
module.exports = (process.env.WEBPACK_CHILD)
? config.find((entry) => entry.name === process.env.WEBPACK_CHILD)
: module.exports = config;