我从头开始用angular -cli创建了angular(6)项目。创建了the official wiki中所说的库
当我尝试导入我的新库时,得到了一个错误。我已经检查配置两天了。
ERROR in ./node_modules/tvmazerrr/fesm5/tvmaze.js Module not found: Error: Can't resolve 'commonjs-proxy:./lib/tvmaze.component' in '/Users/alexanderkozhevin/Desktop/lib-demo/node_modules/tvmazerrr/fesm5' ERROR in ./node_modules/tvmazerrr/fesm5/tvmaze.js Module not found: Error: Can't resolve 'commonjs-proxy:./lib/tvmaze.module' in '/Users/alexanderkozhevin/Desktop/lib-demo/node_modules/tvmazerrr/fesm5' ERROR in ./node_modules/tvmazerrr/fesm5/tvmaze.js Module not found: Error: Can't resolve 'commonjs-proxy:./lib/tvmaze.service' in '/Users/alexanderkozhevin/Desktop/lib-demo/node_modules/tvmazerrr/fesm5' ERROR in ./node_modules/tvmazerrr/fesm5/tvmaze.js Module not found: Error: Can't resolve 'commonjs-proxy:./public_api' in '/Users/alexanderkozhevin/Desktop/lib-demo/node_modules/tvmazerrr/fesm5' ERROR in ./node_modules/tvmazerrr/fesm5/tvmaze.js Module not found: Error: Can't resolve 'commonjs-proxy:./tvmaze.component' in '/Users/alexanderkozhevin/Desktop/lib-demo/node_modules/tvmazerrr/fesm5' ERROR in ./node_modules/tvmazerrr/fesm5/tvmaze.js Module not found: Error: Can't resolve 'commonjs-proxy:@angular/core' in '/Users/alexanderkozhevin/Desktop/lib-demo/node_modules/tvmazerrr/fesm5' ERROR in ./node_modules/tvmazerrr/fesm5/tvmaze.js Module not found: Error: Can't resolve 'commonjsHelpers' in '/Users/alexanderkozhevin/Desktop/lib-demo/node_modules/tvmazerrr/fesm5'
发布于 2018-08-28 20:00:05
我看到的一个解决方案是,在正在构建的库的tsconfig.lib.json中,应该将模块设置如下:
"module": "es2015"如果不设置该值或将其设置为更高的值,可能会导致类似上面看到的问题。另请参阅此git条目:
https://stackoverflow.com/questions/50873111
复制相似问题