fix(admin-ui): modify webpack config to prevent throwing sourcemap errors (#5484)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/admin-ui": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(admin-ui): Make Webpack config more fault tolerant. Removes loader that would throw if dependency was missing source maps
|
||||||
@@ -103,7 +103,6 @@
|
|||||||
"react-router-dom": "6.8.0",
|
"react-router-dom": "6.8.0",
|
||||||
"react-select": "^5.5.4",
|
"react-select": "^5.5.4",
|
||||||
"react-table": "^7.7.0",
|
"react-table": "^7.7.0",
|
||||||
"source-map-loader": "^4.0.1",
|
|
||||||
"style-loader": "^3.3.3",
|
"style-loader": "^3.3.3",
|
||||||
"swc-loader": "^0.2.3",
|
"swc-loader": "^0.2.3",
|
||||||
"swc-minify-webpack-plugin": "^2.1.1",
|
"swc-minify-webpack-plugin": "^2.1.1",
|
||||||
|
|||||||
@@ -54,12 +54,11 @@ export function getWebpackConfig({
|
|||||||
fancy: reporting === "fancy",
|
fancy: reporting === "fancy",
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
: [new MiniCssExtractPlugin()]
|
: [new MiniCssExtractPlugin(), new ReactRefreshPlugin()]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mode: env,
|
mode: env,
|
||||||
bail: !!isProd,
|
devtool: isProd ? false : "inline-source-map",
|
||||||
devtool: isProd ? false : "eval-source-map",
|
|
||||||
entry: [entry],
|
entry: [entry],
|
||||||
output: {
|
output: {
|
||||||
path: dest,
|
path: dest,
|
||||||
@@ -91,6 +90,8 @@ export function getWebpackConfig({
|
|||||||
transform: {
|
transform: {
|
||||||
react: {
|
react: {
|
||||||
runtime: "automatic",
|
runtime: "automatic",
|
||||||
|
development: !isProd,
|
||||||
|
refresh: !isProd,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -146,11 +147,6 @@ export function getWebpackConfig({
|
|||||||
test: /\.(eot|otf|ttf|woff|woff2)$/,
|
test: /\.(eot|otf|ttf|woff|woff2)$/,
|
||||||
type: "asset/resource",
|
type: "asset/resource",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
test: /\.(js|mjs)(\.map)?$/,
|
|
||||||
enforce: "pre",
|
|
||||||
use: ["source-map-loader"],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
test: /\.m?jsx?$/,
|
test: /\.m?jsx?$/,
|
||||||
resolve: {
|
resolve: {
|
||||||
@@ -188,9 +184,8 @@ export function getWebpackConfig({
|
|||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
!isProd && new ReactRefreshPlugin(),
|
|
||||||
|
|
||||||
...webpackPlugins,
|
...webpackPlugins,
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
|
stats: isProd ? "errors-only" : "errors-warnings",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { DuplicateReporterPlugin } from "duplicate-dependencies-webpack-plugin"
|
import { DuplicateReporterPlugin } from "duplicate-dependencies-webpack-plugin"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
|
import openBrowser from "react-dev-utils/openBrowser"
|
||||||
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer"
|
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer"
|
||||||
import { Configuration } from "webpack-dev-server"
|
import { Configuration } from "webpack-dev-server"
|
||||||
import { getWebpackConfig } from "./src/node/webpack/get-webpack-config"
|
import { getWebpackConfig } from "./src/node/webpack/get-webpack-config"
|
||||||
@@ -34,11 +35,19 @@ const getDevServerConfig = () => {
|
|||||||
...{
|
...{
|
||||||
devServer: {
|
devServer: {
|
||||||
port: 7001,
|
port: 7001,
|
||||||
|
hot: true,
|
||||||
historyApiFallback: true,
|
historyApiFallback: true,
|
||||||
|
client: {
|
||||||
|
progress: false,
|
||||||
|
},
|
||||||
static: {
|
static: {
|
||||||
directory: path.resolve(__dirname, "./ui/public"),
|
directory: path.resolve(__dirname, "./ui/public"),
|
||||||
publicPath: "/",
|
publicPath: "/",
|
||||||
},
|
},
|
||||||
|
open: false,
|
||||||
|
onListening: function () {
|
||||||
|
openBrowser(`http://localhost:7001`)
|
||||||
|
},
|
||||||
} as Configuration,
|
} as Configuration,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6344,7 +6344,6 @@ __metadata:
|
|||||||
react-router-dom: 6.8.0
|
react-router-dom: 6.8.0
|
||||||
react-select: ^5.5.4
|
react-select: ^5.5.4
|
||||||
react-table: ^7.7.0
|
react-table: ^7.7.0
|
||||||
source-map-loader: ^4.0.1
|
|
||||||
style-loader: ^3.3.3
|
style-loader: ^3.3.3
|
||||||
swc-loader: ^0.2.3
|
swc-loader: ^0.2.3
|
||||||
swc-minify-webpack-plugin: ^2.1.1
|
swc-minify-webpack-plugin: ^2.1.1
|
||||||
@@ -26180,7 +26179,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2, iconv-lite@npm:^0.6.3":
|
"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2":
|
||||||
version: 0.6.3
|
version: 0.6.3
|
||||||
resolution: "iconv-lite@npm:0.6.3"
|
resolution: "iconv-lite@npm:0.6.3"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -40549,19 +40548,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"source-map-loader@npm:^4.0.1":
|
|
||||||
version: 4.0.1
|
|
||||||
resolution: "source-map-loader@npm:4.0.1"
|
|
||||||
dependencies:
|
|
||||||
abab: ^2.0.6
|
|
||||||
iconv-lite: ^0.6.3
|
|
||||||
source-map-js: ^1.0.2
|
|
||||||
peerDependencies:
|
|
||||||
webpack: ^5.72.1
|
|
||||||
checksum: 880b2c2dd74a71ade45f40bb9de72654eed7e6e6a3c00fb9fb0de28868084f4f00b9376988e43e250fae7c4bb54e85edce32c7651e66388c8bd433e9d6ff4772
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"source-map-resolve@npm:^0.5.0":
|
"source-map-resolve@npm:^0.5.0":
|
||||||
version: 0.5.3
|
version: 0.5.3
|
||||||
resolution: "source-map-resolve@npm:0.5.3"
|
resolution: "source-map-resolve@npm:0.5.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user