aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack.prod.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-10-17 19:42:44 +0200
committerArmand Philippot <git@armandphilippot.com>2021-10-17 19:42:44 +0200
commit1c51be07ec0bce71d09b04fbc48a950a60b09c89 (patch)
treeda99d11b0523cf6fa7401859aac129ef53ec4da4 /config/webpack.prod.js
parent22adbcd1eb5f4233f65cc4f195298c32cfaa156e (diff)
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...)
Diffstat (limited to 'config/webpack.prod.js')
-rw-r--r--config/webpack.prod.js45
1 files changed, 45 insertions, 0 deletions
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()],
+};