From 1c51be07ec0bce71d09b04fbc48a950a60b09c89 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sun, 17 Oct 2021 19:42:44 +0200 Subject: build: add webpack config Downgrade Imagemin-SVGO to v9 because v10 is incompatible with image minimizer. Change ESlint config to avoid lint error (should be dependency instead of devDependency...) --- config/webpack.prod.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 config/webpack.prod.js (limited to 'config/webpack.prod.js') diff --git a/config/webpack.prod.js b/config/webpack.prod.js new file mode 100644 index 0000000..f97fd65 --- /dev/null +++ b/config/webpack.prod.js @@ -0,0 +1,45 @@ +const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const dartSass = require('sass'); +const paths = require('./paths'); + +module.exports = { + mode: 'production', + devtool: false, + optimization: { + minimizer: [new CssMinimizerPlugin(), '...'], + }, + module: { + rules: [ + { + test: /\.(sa|sc|c)ss$/i, + use: [ + { + loader: MiniCssExtractPlugin.loader, + }, + 'css-loader', + { + loader: 'postcss-loader', + options: { + postcssOptions: { + plugins: ['autoprefixer'], + }, + }, + }, + { + loader: 'sass-loader', + options: { + implementation: dartSass, + sassOptions: { + indentWidth: 2, + outputStyle: 'compressed', + includePaths: paths.sassPaths, + }, + }, + }, + ], + }, + ], + }, + plugins: [new MiniCssExtractPlugin()], +}; -- cgit v1.2.3