fix(admin-ui): modify webpack config to prevent throwing sourcemap errors (#5484)

This commit is contained in:
Kasper Fabricius Kristensen
2023-10-30 12:06:58 +01:00
committed by GitHub
parent 8f5b5b51a9
commit b69f182571
5 changed files with 20 additions and 26 deletions

View File

@@ -54,12 +54,11 @@ export function getWebpackConfig({
fancy: reporting === "fancy",
}),
]
: [new MiniCssExtractPlugin()]
: [new MiniCssExtractPlugin(), new ReactRefreshPlugin()]
return {
mode: env,
bail: !!isProd,
devtool: isProd ? false : "eval-source-map",
devtool: isProd ? false : "inline-source-map",
entry: [entry],
output: {
path: dest,
@@ -91,6 +90,8 @@ export function getWebpackConfig({
transform: {
react: {
runtime: "automatic",
development: !isProd,
refresh: !isProd,
},
},
},
@@ -146,11 +147,6 @@ export function getWebpackConfig({
test: /\.(eot|otf|ttf|woff|woff2)$/,
type: "asset/resource",
},
{
test: /\.(js|mjs)(\.map)?$/,
enforce: "pre",
use: ["source-map-loader"],
},
{
test: /\.m?jsx?$/,
resolve: {
@@ -188,9 +184,8 @@ export function getWebpackConfig({
],
}),
!isProd && new ReactRefreshPlugin(),
...webpackPlugins,
].filter(Boolean),
stats: isProd ? "errors-only" : "errors-warnings",
}
}