browsertrix/frontend/webpack.prod.js
Emma Segal-Grossman 9aba24a90e
Emit eslint errors during webpack builds & during dev (#1667)
Following [discussion on
Discord](https://discord.com/channels/895426029194207262/910966759165657161/1227299497546223707),
this enables ESLint errors showing up during dev within Webpack, and
also enforces that all issues (both warnings and errors) will cause
builds to fail during CI.

Other changes:
- Updates some dependencies (primarily to versions that are
type-checked)
2024-04-09 17:42:31 -04:00

45 lines
959 B
JavaScript

// @ts-check
const ESLintPlugin = require("eslint-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const { merge } = require("webpack-merge");
const baseConfigs = require("./webpack.config.js");
const [main, vnc] = baseConfigs;
module.exports = [
merge(main, {
mode: "production",
devtool: "source-map",
// TODO figure out minifying lit templates
optimization: {
runtimeChunk: "single",
splitChunks: {
// Split both async and non-async chunks (only async by default)
chunks: "all",
},
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
drop_console: ["log", "info"],
},
},
}),
],
},
plugins: [
new ESLintPlugin({
failOnWarning: true,
extensions: ["ts", "js"],
}),
],
}),
{
...vnc,
mode: "production",
},
];