const Path = require('path'); const webpackConfig = require('@silverstripe/webpack-config'); const { resolveJS, externalJS, moduleJS, pluginJS, moduleCSS, pluginCSS, } = webpackConfig; const ENV = process.env.NODE_ENV; const PATHS = { MODULES: 'node_modules', ROOT: Path.resolve(), FILES_PATH: '../', SRC: Path.resolve(), }; const config = [ { name: 'css', entry: { bundle: Path.resolve('scss') + '/comments.scss', }, output: { path: Path.resolve('css'), filename: 'styles/[name].css', }, devtool: (ENV !== 'production') ? 'source-map' : '', module: moduleCSS(ENV, PATHS), plugins: pluginCSS(ENV, PATHS), } ]; // 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;