Skip to content

Commit

Permalink
Webpack config update.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfendeksilverstripe committed Feb 14, 2024
1 parent fd7141c commit 5791615
Showing 1 changed file with 12 additions and 32 deletions.
44 changes: 12 additions & 32 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
const Path = require('path');
const webpackConfig = require('@silverstripe/webpack-config');
const {
resolveJS,
externalJS,
moduleJS,
pluginJS,
moduleCSS,
pluginCSS,
JavascriptWebpackConfig,
CssWebpackConfig
} = webpackConfig;

const ENV = process.env.NODE_ENV;
Expand All @@ -19,34 +15,18 @@ const PATHS = {
};

const config = [
{
name: 'js',
entry: {
// JS bundle
new JavascriptWebpackConfig('js', PATHS, 'silverstripe-versioned-snapshot-admin')
.setEntry({
bundle: `${PATHS.SRC}/bundles/bundle.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: {
})
.getConfig(),
// sass to css
new CssWebpackConfig('css', PATHS)
.setEntry({
bundle: `${PATHS.SRC}/styles/bundle.scss`,
},
output: {
path: PATHS.DIST,
filename: 'styles/[name].css',
},
devtool: (ENV !== 'production') ? 'source-map' : '',
module: moduleCSS(ENV, PATHS),
plugins: pluginCSS(ENV, PATHS),
},
})
.getConfig(),
];

// Use WEBPACK_CHILD=js or WEBPACK_CHILD=css env var to run a single config
Expand Down

0 comments on commit 5791615

Please sign in to comment.