配置allowedCommonJsDependencies后ngrx-store-localstorage警告仍存在求助
解决ngrx-store-localstorage的CommonJS依赖警告问题
你遇到的警告是因为ngrx-store-localstorage内部依赖的deepmerge是CommonJS模块,而你之前只把ngrx-store-localstorage加入了允许列表,并没有覆盖它的依赖项。按照下面的步骤修改即可:
- 修改
angular.json中的allowedCommonJsDependencies配置,把deepmerge也添加进去:{ "builder": "@angular-devkit/build-angular:browser", "options": { // 保留你原本的其他配置 "allowedCommonJsDependencies": ["ngrx-store-localstorage", "deepmerge"] } } - 如果你有生产环境的单独配置(
configurations.production),确认这个配置里没有覆盖allowedCommonJsDependencies,如果有,同样要加入deepmerge。 - 清理构建缓存后重新执行构建命令:
ng build --clear-cache
这样就能消除这个CommonJS依赖的警告了。
内容的提问来源于stack exchange,提问作者user3887366
相关产品推荐
相关产品推荐

