corporate-frontend-mithril
Version:
Corporate frontend MithrilJS modules
58 lines (53 loc) • 1.67 kB
JavaScript
const globalConfig = require('./_global');
const app = globalConfig.app;
const merge = require('webpack-merge');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const common = require('./common');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const globImporter = require('node-sass-glob-importer');
const path = require('path');
module.exports = merge(common, {
mode: 'production',
devtool: 'hidden-source-map',
module: {
rules: [{
test: /(\.css|\.scss)$/,
use: ExtractTextPlugin.extract({
use: [{
loader: 'css-loader',
}, {
loader: 'postcss-loader',
}, {
loader: 'sass-loader',
options: {
importer: globImporter(),
},
}, {
loader: 'sass-resources-loader',
options: {
resources: require(path.join(process.cwd(), 'src/styles/utils.js')),
},
}],
}),
}],
},
plugins: [
new CleanWebpackPlugin([`dist/applications/${app}`]),
new ExtractTextPlugin({
filename: (getPath) => {
return getPath('css/[name]-[hash].css');
},
allChunks: true,
}),
],
optimization: {
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
sourceMap: true,
}),
],
},
});