nixos-search/frontend/config/webpack.prod.js
github-actions[bot] 84ce7fdf52
Update npm dependencies (also flake.lock: Update) (#532)
* flake.lock: Update

Flake lock file updates:

• Updated input 'flake-utils':
    'github:numtide/flake-utils/c0e246b9b83f637f4681389ecabcb2681b4f3af0' (2022-08-07)
  → 'github:numtide/flake-utils/6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817' (2022-10-29)
• Updated input 'nixos-org-configurations':
    'github:NixOS/nixos-org-configurations/569797100aac69780a12542c2143bb741380d4ec' (2022-08-17)
  → 'github:NixOS/nixos-org-configurations/cebfd15c30724cadacf85b5fd950dc1070c4eb7d' (2022-10-26)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/f3d0897be466aa09a37f6bf59e62c360c3f9a6cc' (2022-08-25)
  → 'github:NixOS/nixpkgs/448a599c49978c2794401bfc3a2e1fba1a8663be' (2022-10-28)

* Switch from yarn to npm for frontend

also update all the npm dependencies

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rok Garbas <rok@garbas.si>
2022-11-03 22:26:58 +01:00

64 lines
1.8 KiB
JavaScript

const {merge} = require('webpack-merge');
const CopyWebpackPlugin = require("copy-webpack-plugin");
// JS minification
const TerserPlugin = require("terser-webpack-plugin");
// Production CSS assets - separate, minimised file
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const common = require('./webpack.common.js');
const prod = {
mode: 'production',
optimization: {
minimize: true,
minimizer: [
new TerserPlugin(),
new CssMinimizerPlugin(),
]
},
plugins: [
// Copy static assets
new CopyWebpackPlugin({
patterns: [{from: "src/assets"}]
}),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
filename: "[name]-[chunkhash].css"
})
],
module: {
rules: [
{
test: /\.elm$/,
use: {
loader: "elm-webpack-loader",
options: {
optimize: true
}
}
},
{
test: /\.(sa|sc|c)ss$/i,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [
require("autoprefixer"),
],
},
}
}, "sass-loader"
]
}
]
}
};
module.exports = merge(common(false), prod);