Search code examples
polymerbabeljs

BabelHelpers is not defined using Polymer


I'm using Polymer and its build process. The bundled files are generated throughmy polymer.json file.

I'm not explicitely using Babel, I've just seen it's used by "paper-autocomplete".

When going to the website, I have a js error stating the BabelHelpers is not defined.

  • When I use MAJ+F5, it works !
  • When I use F5, it doesn't work (BabelHelpers is not defined)

When running it locally it works fine. When I deploy it to my server, I face this issue.

I'm running it as a standalone Java application as it has a Spring backend. The website as multiple entry points, it works fine for all other ones.

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"
  ]
}

Solution

  • I made a few changes, but I don't know which one solved the issue. The problem came from paper-autocomplete. When I stopped using it I didn't have the issue anymore. I'm still using it, but I made several changes :

    • I made sure I was using the generated service-worker
    • I stopped using the version of JQuery that was in my bower (3.2.1) and used it from JQuery CDN (2.3.1) as I've seen it caused issues sometimes
    • Added manifest.json in the polymer.json file