- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我已根据此 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/
第一年+ 我已经使用 esm 和 std/esm 包编写了我所有的代码,我能够无缝地使用 cjs 的依赖包,没有问题,而不需要 babel。 在 nodejs V14 中,混合的 esm/cjs 支持
我在 plunker 中有以下代码... // Thing.js export class Thing{ constructor(){ console.log("This thing is
我尝试使用 --experimental-modules 标志在 Node.js v8.7.0 中使用此语法导入 ESM 模块: import { check, validationResult }
所以我正在使用包 esm 和 module-alias,但似乎 esm 没有注册模块别名的路径。 这是我加载服务器文件的方式: nodemon -r esm ./src/index.js 8081 这
我想将 typescript react 应用程序作为组件捆绑到 ES 模块或 UMD 中。但是生成的 ES 包会产生一个无效的模块 js。 在 bundle 上它给了我这个提示。但我找不到任何解决方
我很好奇 ESM 的 tree-shaking/死代码消除是如何工作的。我在各种 Node.js 项目中使用 Typescript,并开始导出自己的 ESM 包 (tsc --module es201
我正在构建一个 webpack 应用程序,我有兴趣在整个应用程序中使用 ESM,这意味着使用 ESM 导入构建 webpack.config 文件。 我现在可以使用 Babel,但这是在 npm 添加
我想我已经阅读了 SO 上的每个线程以及互联网上的每个相关页面,一切都有一些问题 我想: 使用 webpack 捆绑我的 web 应用程序 在我的源 js 中使用 ES 模块并将它们转换为更广泛的浏览
我即将在 SMPP 上工作。我对从计算机系统到移动站的消息如何传递有基本的了解,我已经阅读了有关消息如何从 ESME 到 SMSC 再到移动站的信息。但实际上我无法理解。我的意思是,这些 (ESME
我有以下示例运行,而 JS 在其上没有捆绑器。 // index.js ;(async () => { const mod = await import('/index.json') cons
在阅读 webpack 文档中有关 tree shaking 的内容时,我遇到了这句话: In a 100% ESM module world, identifying side effects is
在阅读 webpack 文档中有关 tree shaking 的内容时,我遇到了这句话: In a 100% ESM module world, identifying side effects is
我正在开发一个 SMS 网关,我在考虑我应该在其中实现的功能。因此,我查看了一些 SMS 网关(SMSNOW、SMS studio 和 Ozeki)作为示例。 我几乎完成了实现,但我遇到了几乎所有 S
我正在尝试在 ESM 模块上使用 tone.js。 (我可以在带有 bundler 的“commonjs”中毫无问题地使用它) 在我的html中 和 tests.js: import * as To
我正在尝试获取 Esri ArcGis's NPM package与 SvelteKit 一起工作。 根据链接文档,@arcgis/core 应该是 ESM。但是,当我尝试将其导入 SvelteKit
我有以下组件: App.js import React from "react"; import { Slider } from "./Slider"; function App() { retu
当浏览器现在支持原生 ESM 时,为什么开发人员仍然需要使用像 rollup 和 webpack 这样的模块捆绑器 最佳答案 你不需要模块打包器——开发人员甚至在模块和 Webpack 存在之前就能够
我一直在尝试解决这个问题一个星期,但似乎无法真正找到问题所在。 我关注了this tutorial但我没有自己的项目结构(见下图) 在 esm.js 中: require = require("esm
我的设置 Node v14.16.0 我有一个测试文件,其中包含一个用 ESM 模块 (import) 编写的简单测试。 在 package.json我有一个脚本(遵循Jest documentati
我有一个组件库,它将发布到 npm 以供 razzle 应用程序使用。我想要对最佳实践发表意见的主要问题是,这些包应该用 cjs 还是 esm 构建,每个的缺点是什么? 我可以只构建到 cjs 吗?
我是一名优秀的程序员,十分优秀!