使用“pdfjs”npm模块构建项目时出现以下错误
Module parse failed: Unexpected token (2413:45)
File was processed with these loaders:
* ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
* ./node_modules/@ngtools/webpack/src/ivy/index.js
You may need an additional loader to handle the result of these loaders.
| intent: renderingIntent,
| renderInteractiveForms: renderInteractiveForms === true,
> annotationStorage: annotationStorage?.getAll() || null
| });
| } 如何解决这个问题?任何解决办法或建议都会有很大帮助!
发布于 2021-05-25 06:50:58
可以通过将“pdfjs”模块版本的版本从2.7.570降到较低的稳定版本,比如2.5.207来修正此错误。
另一个解决方法可能是将webpack的版本从4.x升级到5.x,但这不是一个推荐的解决方案,因为这可能会给项目的其他依赖模块带来问题。
发布于 2021-09-29 07:29:17
我也遇到过同样的错误。这对我有用,也许对你有用
"fileReplacements": [
{
"replace": "./node_modules/jspdf/dist/jspdf.es.min.js",
"with": "./node_modules/jspdf/dist/jspdf.umd.min.js"
}
],在angular.json文件中,
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
place the above code here....
........
}https://stackoverflow.com/questions/67641075
复制相似问题