我是webpack的新手,我需要设置一下来生成源图.我正在webpack serve从命令行运行,它成功编译.但我真的需要源图.这是我的webpack.config.js.
var webpack = require('webpack');
module.exports = {
output: {
filename: 'main.js',
publicPath: '/assets/'
},
cache: true,
debug: true,
devtool: true,
entry: [
'webpack/hot/only-dev-server',
'./src/components/main.js'
],
stats: {
colors: true,
reasons: true
},
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
'styles': __dirname + '/src/styles',
'mixins': __dirname + '/src/mixins',
'components': __dirname + '/src/components/',
'stores': __dirname + '/src/stores/',
'actions': __dirname + '/src/actions/'
}
},
module: {
preLoaders: [{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'jsxhint'
}],
loaders: …Run Code Online (Sandbox Code Playgroud) 当我的 React 17 应用程序出现错误时,Chrome 开发者控制台会显示块文件路径的错误,而不是包含有错误的组件的实际源文件。是否可以显示真实的文件路径而不是块?我已经检查过,所有文件都有为它们生成的源映射。
\n样本错误
\nindex.js:1 Warning: Encountered two children with the same key, `1`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted \xe2\x80\x94 the behavior is unsupported and could change in a future version.\n at tr\n at http://localhost:3000/static/js/vendors~main.chunk.js:1363:73\n at TableRow (http://localhost:3000/static/js/vendors~main.chunk.js:42348:84)\n at thead\n at http://localhost:3000/static/js/vendors~main.chunk.js:1363:73\n at TableHead (http://localhost:3000/static/js/vendors~main.chunk.js:41463:84)\n at HeadTable (http://localhost:3000/static/js/4.chunk.js:504:21)\n at table\n ......\n\nRun Code Online (Sandbox Code Playgroud)\n期望结果的样本
\nindex.js:1 Warning: Encountered two children …Run Code Online (Sandbox Code Playgroud)