mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
40 lines
906 B
JavaScript
40 lines
906 B
JavaScript
|
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;
|