2017-08-16 05:20:15 +02:00
|
|
|
const Path = require('path');
|
|
|
|
// Import the core config
|
|
|
|
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',
|
|
|
|
FILES_PATH: '../',
|
|
|
|
ROOT: Path.resolve(),
|
|
|
|
SRC: Path.resolve('client/src'),
|
|
|
|
DIST: Path.resolve('client/dist'),
|
|
|
|
THIRDPARTY: Path.resolve('thirdparty'),
|
|
|
|
};
|
|
|
|
|
|
|
|
const config = [
|
|
|
|
{
|
|
|
|
name: 'js-frontend',
|
|
|
|
entry: {
|
|
|
|
userforms: `${PATHS.SRC}/bundles/bundle.js`,
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: PATHS.DIST,
|
|
|
|
filename: 'js/[name].js',
|
|
|
|
},
|
|
|
|
devtool: (ENV !== 'production') ? 'source-map' : '',
|
|
|
|
resolve: resolveJS(ENV, PATHS),
|
|
|
|
module: moduleJS(ENV, PATHS),
|
|
|
|
plugins: pluginJS(ENV, PATHS),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'js-cms',
|
|
|
|
entry: {
|
|
|
|
'userforms-cms': `${PATHS.SRC}/bundles/bundle-cms.js`,
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: PATHS.DIST,
|
|
|
|
filename: 'js/[name].js',
|
|
|
|
},
|
|
|
|
devtool: (ENV !== 'production') ? 'source-map' : '',
|
|
|
|
resolve: resolveJS(ENV, PATHS),
|
|
|
|
externals: externalJS(ENV, PATHS),
|
|
|
|
module: moduleJS(ENV, PATHS),
|
|
|
|
plugins: pluginJS(ENV, PATHS),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'css',
|
|
|
|
entry: {
|
2017-08-21 02:13:19 +02:00
|
|
|
userforms: `${PATHS.SRC}/styles/bundle.scss`,
|
|
|
|
'userforms-cms': `${PATHS.SRC}/styles/bundle-cms.scss`,
|
2017-08-16 05:20:15 +02:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: PATHS.DIST,
|
|
|
|
filename: 'styles/[name].css'
|
|
|
|
},
|
|
|
|
devtool: (ENV !== 'production') ? 'source-map' : '',
|
|
|
|
module: moduleCSS(ENV, PATHS),
|
|
|
|
plugins: pluginCSS(ENV, PATHS),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
module.exports = config;
|