javascript - Webpack 错误堆栈未显示在源映射文件中
问题描述
我在玩一个react
应用程序并介绍了 webpack。控制台错误堆栈指的是react-dom.production.min.js
一个巨大的缩小文件,而不是带有未定义变量的特定文件。已映射单独的文件,但错误堆栈未引用具有错误的特定文件。
错误堆栈
ReferenceError: omak is not defined
Stack trace:
render@webpack-internal:///10:124:1
l@webpack-internal:///17:131:336
beginWork@webpack-internal:///17:138:287
e@webpack-internal:///17:176:105
f@webpack-internal:///17:176:379
G@webpack-internal:///17:182:329
x@webpack-internal:///17:181:378
n@webpack-internal:///17:181:221
B@webpack-internal:///17:180:117
v@webpack-internal:///17:179:51
b@webpack-internal:///17:190:302
updateContainer@webpack-internal:///17:191:389
tg.prototype.render@webpack-internal:///17:228:366
Eg/<@webpack-internal:///17:242:473
unbatchedUpdates@webpack-internal:///17:188:42
Eg@webpack-internal:///17:242:392
render@webpack-internal:///17:244:189
@webpack-internal:///20:19:1
@http://127.0.0.1:8080/bundle.js:217:1
__webpack_require__@http://127.0.0.1:8080/bundle.js:20:12
@http://127.0.0.1:8080/bundle.js:69:18
@http://127.0.0.1:8080/bundle.js:1:11
webpack.config.js
const path = require('path');
//const BabiliPlugin = require('babili-webpack-plugin');
module.exports = {
entry: './src/app.js',
output: {
path: path.join(__dirname, 'public'),
filename: 'bundle.js'
},
optimization: {
minimize: false
},
module: {
rules: [{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
}]
},
devtool: 'cheap-module-eval-source-map'
}
包.json
{
"scripts": {
"serve": "live-server public/",
"build": "webpack --watch",
"build-babel": "babel src/app.js --out-file=public/scripts/app.js --preset=env,react --watch"
},
"dependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "1.5.2",
"babel-preset-react": "^6.24.1",
"babili-webpack-plugin": "^0.1.2",
"live-server": "^1.2.0",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"validator": "^10.2.0",
"webpack": "^4.8.3"
},
"devDependencies": {
"webpack-cli": "^2.1.3"
}
}
萤火虫来源
解决方案
推荐阅读
- php - 文件没有上传到服务器php
- php - 将 Laravel 项目上传到网络
- javascript - 如何对 CRA(create-react-app)中的资产进行版本控制?
- spring-boot - Spring Data Lovelace GA 发布 + Spring Boot 发布
- corda - 部署 AWS Corda 企业模板时出现 AMQP 握手超时错误
- excel - Excel成绩单
- mysql - 如何查询获取具有不同值的列的计数
- docusignapi - 我无法获得请求身份验证令牌 - 错误 invalid_grant
- javascript - Javascript 正则表达式表单验证返回错误
- postgresql - BIGINT 列的 PostgreSQL GIN 索引