首页 文章

聚合物3:聚合物构建后代码不起作用

提问于
浏览
0

我的polymer.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通过路由导入动态 . 所以我尝试以不同的方式尝试构建一些构建选项 . 我发现当我构建没有bundle时,构建的代码可以工作 . 我不知道为什么我的代码无法通过 polymer build 捆绑 . 如果有人好奇这个问题,需要完整的源代码 . 联络我

工具总结

  • system:ubuntu 16.04

  • 聚合物:1.7.7

  • node:10.1.0

1 回答

  • 0

    在您的polymer.json中,您需要添加:

    "fragments": [
        "src/article-list.js"
      ],
    

相关问题