build - 聚合物 3:聚合物构建后代码不起作用
问题描述
我的聚合物.json
{
"entrypoint": "index.html",
"shell": "src/boo-blogger/boo-blogger.js",
"sources": [
"images/*",
"fonts/*"
],
"extraDependencies": [
"manifest.json",
"node_modules/@webcomponents/webcomponentsjs/*.js",
"node_modules/web-animations-js/web-animations-next-lite.min.js",
"node_modules/@webcomponents/webcomponentsjs/bundles/*.js"
],
"builds": [
{
"name": "es6",
"bundle": true,
"browserCapabilities": [
"es2015",
"modules"
],
"js": {
"minify": true,
"transformModulesToAmd": true
},
"html": {
"minify": true
},
"css": {
"minify": true
},
"addServiceWorker": true
}
],
"npm": true,
"lint": {
"rules": [
"polymer-3"
]
}
}
我有问题
article-list.js:5 Uncaught (in promise) TypeError: _booBlogger.html$1 is not a function
article-list.js 通过路由动态导入。所以我尝试尝试一些不同的构建选项来构建。我发现当我在没有包的情况下构建时,构建的代码可以工作。我不知道为什么我的代码不能通过polymer build
. 如果有人好奇这个问题并且需要完整的源代码。联络我
工具总结
- 系统:ubuntu 16.04
- 聚合物:1.7.7
- 节点:10.1.0
解决方案
在您的 polymer.json 中,您需要添加:
"fragments": [
"src/article-list.js"
],
推荐阅读
- amazon-web-services - 哪个使用 Cognito 用户池或身份池进行社交登录?
- python - 通过使用 pybind11 的虚函数通过引用传递 std::vector 的问题
- javascript - React - 从嵌入式组件中的数组获取内容
- python - 创建一个函数以遍历现有数据框并将值添加到新列
- python - 如何使用 GitPython 在一段时间内跟踪 Git 提交
- postgresql - postgres:时间戳字段的索引
- java - 为什么没有点击正确的 TextField TestFX?
- python - 在 Pandas 中使用 groupby 函数时如何解决“keyerror”?
- java - 在Android中切换活动后无法单击按钮
- ruby-on-rails - 尝试更新时基本 CRUD 应用程序出错:ActiveRecord::StatementInvalid (SQLite3::SQLException: no such column:addresses.player_id)