angular - 与以前版本的 Angular 5/6/7 相比,在 Angular 8 中为 ng 构建生成的文件不同
问题描述
这是我第一次研究 Angular Web 组件。我尝试了许多在线教程甚至视频教程,我看到教程中讨论的示例是 angular 5/6/7 版本,但找不到 angular 8 的示例或教程。
就像npm run build
在 Angular 5/6/7 版本中一样,它会生成以下文件:
"./dist/my-app/runtime.js",
"./dist/my-app/polyfills.js",
"./dist/my-app/scripts.js",
"./dist/my-app/main.js"
但在 Angular 8 中,它会生成以下文件:
"./dist/my-app/runtime-es2015.js",
"./dist/my-app/runtime-es2015.js",
"./dist/my-app/polyfills-es2015.js",
"./dist/my-app/polyfills-es5.js",
"./dist/my-app/scripts.js",
"./dist/my-app/main-es5.js"
"./dist/my-app/main-es2015.js"
我尝试了这些教程 Web Components with angular
我被困在这部分
创建一个脚本以将我们的 Web 组件作为单个文件弹出
因为文件不匹配
解决方案
这是由于不同的负载。Angular 8 中引入的一项新功能,用于在所有浏览器中加载应用程序。在 Angular 8 中,文件浏览器列表必须位于项目根文件夹中。项目需要以下条目来禁用差异加载,这有助于匹配文件
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11
not samsung 4
not android 4.4.3-4.4.4
not last 2 ie_mob versions
not last 2 op_mini versions
not last 2 op_mob versions
not last 2 baidu versions
not last 2 kaios versions
not last 2 and_uc versions
not last 2 and_qq versions
not last 2 edge versions
not chrome 49
推荐阅读
- html - 为什么我的第二个 div 隐藏在开头的 div 后面?
- javascript - 没有机器人的公会成员总是 1
- django - 在 Docker 容器中使用 VS Code 调试 Django 会关闭容器
- javascript - Redux 存储区中仅在 Redux 外部发生突变的可变对象会导致意外的副作用吗?
- javascript - 脚本元素未加载到淘汰赛 js 模板中
- python - 计算一条线上的二维插值函数
- python - ValueError:logits 和标签必须具有相同的形状 ((22, 8, 8, 2) vs (22, 2))
- python - 使用 Pandas 数据框中的列来搜索和更新不同数据框中的列
- python - 使用 seaborn/matplotlib 将直线图变成曲线图
- java - AMQP消费者在托管rabbitMQ实例的服务器之外没有收到消息