Dynamic page loading failed for main.js #13031
Replies: 1 comment 4 replies
-
Here is my v3 of webpack configuration: Which I am trying ti migrate to webpack5 compatible.
module.exports = Object.assign({}, baseClientConfig, {
|
Beta Was this translation helpful? Give feedback.
-
The production mode of webpack build when served issues the error:
Uncaught (in promise) Error: Dynamic page loading failed: value@http://localhost:3000/main.js:2:171897
in the browser.
The development mode works just fine.
Could someone help me spotting the issue here ? What is wrong with my production webpack file here:
*BEGINS HERE
module.exports = Object.assign({}, baseClientConfig, {
mode: 'production',
optimization: {
splitChunks: {
chunks: 'async',
minSize: 2
}
},
resolve:{
fallback:{
"util": require.resolve("util/"),
"https": require.resolve("https-browserify"),
"http": require.resolve("stream-http"),
"buffer": require.resolve("buffer/")
}
},
entry: [...config.client.entry],
module: {
rules: [
...baseClientConfig.module.rules,
{
test: /.(scss|sass)$/,
use: [
{loader: MiniCssExtractPlugin.loader},
{
loader: "css-loader",
options: {
importLoaders: 1,
// localIdentName: "[path][name][local]--[hash:base64:8]",
}
},
{
loader: "resolve-url-loader"
},
{
loader: "postcss-loader",
options: {
postcssOptions:{
config: config.client.postcss
}
}
},
{
loader: "sass-loader",
options: {
implementation: require("node-sass"),
sassOptions:{
includePaths: config.client.sass_include_paths
}
}
},
{
loader: "import-glob"
}
]
},
{
test: /.less$/,
use: [
{loader: MiniCssExtractPlugin.loader},
{
loader: "css-loader",
options: {
importLoaders: 1,
// localIdentName: "[path][name][local]--[hash:base64:8]",
}
},
{
loader: "postcss-loader",
options: {
postcssOptions:{
config: config.client.postcss
}
}
},
{
loader: "less-loader",
options: {
strictMath: true,
noIeCompat: true
}
}
]
},
{
test: /.css$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{
loader: "css-loader",
options: {
importLoaders: 1,
// localIdentName: "[path][name]_[local]--[hash:base64:8]",
}
},
{
loader: "postcss-loader",
options: {
postcssOptions:{
config: config.client.postcss
}
}
}
]
}
]
},
devtool:"cheap-module-source-map",
plugins: [
// new webpack.optimize.ModuleConcatenationPlugin(),
...baseClientConfig.plugins,
new Dotenv(),
new webpack.EnvironmentPlugin({
AUTH_PROTOCOL: "HTTPS",
AUTH_SERVER_HOST: null,
AUTH_SERVER_PORT: null,
DEBUG: false,
DEV_TOOLS: false,
HOST: null,
NODE_ENV: "production",
PORT: null,
PROTOCOL: "HTTPS",
SERVER_HOST: null,
SERVER_PORT: null,
WS_SERVER_HOST: null,
WS_SERVER_PORT: null,
WS_PROTOCOL: "wss",
REACT_APP_BRANCH: JSON.stringify(process.env.REACT_APP_BRANCH) || JSON.stringify(dotenv.parsed['REACT_APP_BRANCH']),
REACT_APP_ENVIRONMENT: JSON.stringify(process.env.REACT_APP_ENVIRONMENT) || JSON.stringify(dotenv.parsed['REACT_APP_ENVIRONMENT']),
}),
new webpack.LoaderOptionsPlugin({
minimize: true
}),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// all options are optional
filename: 'stylesheets/[name].css',
chunkFilename: '[id].css',
ignoreOrder: true, // Enable to remove warnings about conflicting order
}),
]
});
*ENDS HERE
Beta Was this translation helpful? Give feedback.
All reactions