browsertrix/frontend/webpack.dev.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

56 lines
1.3 KiB
JavaScript

// @ts-check
const path = require("path");
const ESLintPlugin = require("eslint-webpack-plugin");
const { merge } = require("webpack-merge");
const devServerConfig = require("./config/dev-server.js");
const baseConfigs = require("./webpack.config.js");
const [main, vnc] = baseConfigs;
const shoelaceAssetsSrcPath = path.resolve(
__dirname,
"node_modules/@shoelace-style/shoelace/dist/assets",
);
const shoelaceAssetsPublicPath = "shoelace/assets";
module.exports = [
merge(main, {
devtool: "eval-cheap-source-map",
/** @type {import('webpack-dev-server').Configuration} */
devServer: {
watchFiles: ["src/**/*", __filename],
open: true,
compress: false,
hot: false,
static: [
{
directory: shoelaceAssetsSrcPath,
publicPath: "/" + shoelaceAssetsPublicPath,
},
],
historyApiFallback: true,
proxy: devServerConfig.proxy,
onBeforeSetupMiddleware: devServerConfig.onBeforeSetupMiddleware,
port: 9870,
},
cache: {
type: "filesystem",
hashAlgorithm: "xxhash64",
buildDependencies: {
config: [__filename],
},
},
plugins: [
new ESLintPlugin({
extensions: ["ts", "js"],
}),
],
}),
{
...vnc,
mode: "production",
},
];