-
Notifications
You must be signed in to change notification settings - Fork 12
/
webpack.config.js
33 lines (30 loc) · 1.02 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
const webpack = require('webpack');
const { JavascriptWebpackConfig, CssWebpackConfig } = require('@silverstripe/webpack-config');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const Path = require('path');
const PATHS = {
MODULES: 'node_modules',
THIRDPARTY: '../../thirdparty',
ROOT: Path.resolve(),
SRC: Path.resolve('client/src'),
DIST: Path.resolve('client/dist'),
LEGACY_SRC: Path.resolve('client/src/legacy'),
};
const config = [
// Main JS bundles
new JavascriptWebpackConfig('js', PATHS, 'silverstripers/seo')
.setEntry({
bundle: `${PATHS.SRC}/bundles/bundle.js`,
})
.getConfig(),
// sass to css
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)
: config;