2018-03-05 23:03:12 +01:00
|
|
|
const Path = require('path');
|
2023-01-18 01:11:33 +01:00
|
|
|
const { JavascriptWebpackConfig, CssWebpackConfig } = require('@silverstripe/webpack-config');
|
2018-02-01 08:39:53 +01:00
|
|
|
|
2018-03-05 23:03:12 +01:00
|
|
|
const ENV = process.env.NODE_ENV;
|
2018-02-01 08:39:53 +01:00
|
|
|
const PATHS = {
|
2018-03-05 23:03:12 +01:00
|
|
|
ROOT: Path.resolve(),
|
|
|
|
SRC: Path.resolve('client/src'),
|
|
|
|
DIST: Path.resolve('client/dist'),
|
2018-02-01 08:39:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const config = [
|
2023-01-18 01:11:33 +01:00
|
|
|
// Main JS bundle
|
|
|
|
new JavascriptWebpackConfig('js', PATHS, 'colymba/gridfield-bulk-editing-tools')
|
|
|
|
.setEntry({
|
2018-08-16 14:45:17 +02:00
|
|
|
main: `${PATHS.SRC}/bundles/bundle.js`,
|
2023-01-18 01:11:33 +01:00
|
|
|
})
|
|
|
|
.getConfig(),
|
|
|
|
// sass to css
|
|
|
|
new CssWebpackConfig('css', PATHS)
|
|
|
|
.setEntry({
|
2018-08-16 14:45:17 +02:00
|
|
|
main: `${PATHS.SRC}/styles/bundle.scss`,
|
2023-01-18 01:11:33 +01:00
|
|
|
})
|
|
|
|
.getConfig(),
|
2018-02-01 08:39:53 +01:00
|
|
|
];
|
|
|
|
|
2018-08-16 14:45:17 +02:00
|
|
|
// 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)
|
2023-01-18 01:11:33 +01:00
|
|
|
: config;
|