Answer the question
In order to leave comments, you need to log in
How to make webpack do source maps for lazy loading React components?
If all application components are simply connected to one index.js, which is entry, and also in the webpack config devtool: "source-map"
, then in the developer console in Sources you can see the following:
true
/ false
, "inline"
, "both"
, but all these values create maps only in something like this:const path = require('path')
module.exports = {
entry : './src/index.js',
output : {
filename : 'main.js',
sourceMapFilename : 'main.map',
path : path.resolve(__dirname, 'dist')
},
watch : true,
mode : 'development',
devtool: 'source-map',
module : {
rules : [
{
test : /\.js$/,
exclude : /(node_modules)/,
loader : 'babel-loader',
options: {
presets: [ '@babel/preset-react' ],
plugins: [ '@babel/plugin-syntax-dynamic-import' ],
// sourceMaps: true,
},
}
]
}
}
Answer the question
In order to leave comments, you need to log in
You output.sourceMapFilename
don't need to specify anything. Then there will be maps for all scripts
I won’t tell you the problem, but I can suggest looking at the config in CRA.
devtoolModuleFilenameTemplate some trick
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question