首页 文章

BabelHelpers未使用Polymer定义

提问于
浏览
1

我正在使用Polymer及其构建过程 . 捆绑的文件是通过my polymer.json文件生成的 .

我没有明确地使用Babel,我刚刚看到它被“paper-autocomplete”使用了 .

当去网站时,我有一个js错误,说明没有定义BabelHelpers .

  • 当我使用MAJ F5时,它有效!

  • 当我使用F5时,它不起作用(BabelHelpers未定义)

在本地运行它时工作正常 . 当我将它部署到我的服务器时,我遇到了这个问题 .

我将它作为一个独立的Java应用程序运行,因为它有一个Spring后端 . 该网站作为多个入口点,适用于所有其他入口点 .

The stacktrace :

BabelHelpers

Command :

polymer build --js-minify --css-minify --html-minify

The polymer.json file

{
  "entrypoint": "pt.html",
  "builds": [{
      "bundle": true,
      "js": {"compile": true, "minify": true},
      "css": {"minify": true},
      "html": {"minify": false},
      "addServiceWorker": true 
    }],
  "shell": "resources/elements-platform.html",
  "fragments": [
    "resources/html/lazy-resources.html",
    "resources/html/ym-dashboard.html",
    "resources/html/ym-partners.html",
    "resources/html/ym-favorite.html",
    "resources/html/ym-agenda.html",
    "resources/html/ym-todos.html",
    "resources/html/ym-profile.html",
    "resources/html/ym-messages.html",
    "resources/html/shop-list.html",
    "resources/html/shop-detail.html"
  ],
  "sources": [
   "resources/src/**/*",
   "resources/css/**/*",
   "resources/data/**/*",
   "resources/images/**/*",
   "resources/img/**/*",
   "resources/js/*",
   "resources/js/cal/*",
   "resources/js/countdown/*",
   "resources/bower.json"
  ],
  "extraDependencies": [
    "resources/bower_components/webcomponentsjs/webcomponents-lite.min.js"
  ]
}

3 回答

  • 1

    几天前,我将Polymer-cli更新到最新版本后,我遇到了同样的问题 . 但在我的情况下,我的应用程序在本地虚拟主机上抛出相同的错误(带有自签名证书) . 在 生产环境 网站上很好 .

    实际上,babelHelpers被注入到 polymer.json 文件中被选为 entrypoint 的文件中 . 如果你有正确的现有文件,也许试着看看那里 .

    github上存在这个问题的问题很少 . 不幸的是,没有经过验证的答案(Polymer团队并不真正关心github问题)

    https://github.com/Polymer/polymer-cli/issues/787 https://github.com/Polymer/polymer-cli/issues/765

    stackoverflow上也有同样的问题答案:polymer-cli - getting "Can’t find variable: babelHelpers" when I set compile to true

  • 0

    我也看到 'babelHelpers' is undefined . 就我而言,它来自redux.js:

    q='object'==('undefined'===typeof self?'undefined':babelHelpers
    .typeof(self))&&self&&self.Object===Object&&self,r=p||q||
    Function('return this')(),s=r.Symbol,t=Object.prototype,
    

    F12 Console error in IE11

    Babel助手也在Issue #606中被提升,它表示已经解决并关闭了 . 但它或类似的东西又回来了 .

  • 1

    我做了一些改动,但我不知道是哪一个解决了这个问题 . 问题来自纸张自动完成 . 当我停止使用它时,我不再有问题了 . 我还在使用它,但我做了几处修改:

    • 我确定我正在使用生成的服务工作者

    • 我停止使用我的凉亭(3.2.1)中的JQuery版本,并使用它来自JQuery CDN(2.3.1),因为我看到它有时会引起问题

    • 在polymer.json文件中添加了manifest.json

相关问题