gpt4 book ai didi

Angular 4 到 5 更新 ./node_modules/@angular/core/esm5/core.js 中的警告

转载 作者:太空狗 更新时间:2023-10-29 18:19:08 25 4
gpt4 key购买 nike

我已根据此 tutorial 将 Angular 4 更新为 5 ,在此之后我的构建在 webpack 上失败并出现两个警告:

  WARNING in ./node_modules/@angular/core/esm5/core.js
6553:15-36 Critical dependency: the request of a dependency is an expression
@ ./node_modules/@angular/core/esm5/core.js
@ ./ClientApp/boot.browser.ts
@ multi event-source-polyfill webpack-hot-middleware/client?path=__webpack_hmr&dynamicPublicPath=true ./ClientApp/boot.browser.ts

WARNING in ./node_modules/@angular/core/esm5/core.js
6573:15-102 Critical dependency: the request of a dependency is an expression
@ ./node_modules/@angular/core/esm5/core.js
@ ./ClientApp/boot.browser.ts
@ multi event-source-polyfill webpack-hot-middleware/client?path=__webpack_hmr&dynamicPublicPath=true ./ClientApp/boot.browser.ts

我经历了这个topic ,但没有任何帮助(也许我错过了什么)。这是我的 webpack.config.vendor.js 插件的样子:

    plugins: [
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', Popper: 'popper.js' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/11580
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/14898
new webpack.IgnorePlugin(/^vertx$/) // Workaround for https://github.com/stefanpenner/es6-promise/issues/100
]

我最初使用 Angular 模板和 Visual Studio 中的 .NET Core API。

最佳答案

当您使用 VS 2017 随附的较新的 Angular 模板并将 Angular 版本 4 升级到 5.x.x 时,您需要运行以下命令以避免在编译时收到一些警告。

webpack --config webpack.config.vendor.js

在项目的根目录下从命令提示符运行它会删除您在上面的 OP 中看到的警告。

这样做是重建 wwwroot/dist 文件夹中的 vendor.js 文件,以根据您安装的 Angular(和其他)npm 包更新它。

关于Angular 4 到 5 更新 ./node_modules/@angular/core/esm5/core.js 中的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48723673/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com