- 今天项目打包时,一直报错:
Unhandled rejection Error: original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values. at SourceMapGenerator_validateMapping [as _validateMapping] (/Users/threewhisky/Desktop/miaomovie/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:276:15) at SourceMapGenerator_addMapping [as addMapping] (/Users/threewhisky/Desktop/miaomovie/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:110:12) 后面的省略了
- 半夜解决不了这个bug睡不了觉。
- 眼皮都睁不开了,还通过各种渠道搜索到了原因。
- 原因为我使用babel-minify-webpack-plugin插件的同时,使用source-map,就会发生报错。
- 找到了两个解决方案:
- 懒惰方案:
直接给vue.config.js
添加productionSourceMap: false
项跳过此功能。module.exports = { // other config productionSourceMap: false }
- 解决方法:执行
npm i terser@4.0.0
安装terser再进行编译
因为source map中缺少了terser模块导致。
- 懒惰方案:
- 解决问题,打包完成。
- 下面是一些与此bug相关的问答网页:
- 太累了,睡觉。
webpack的source-map报错Unhandled rejection Error: original.line and original.column are not numbers
最新推荐文章于 2023-11-25 12:17:06 发布