polymer-cli - getting “Can’t find variable: babelH

2019-07-19 17:58发布

问题:

I use Polymer 2.0 and my build setting is:

"builds": [
{
  "name": "bundled",
  "bundle": true,
  "js": { "compile": true},
  "css": { "minify": true },
  "html": { "minify": true }
}]

I get "Can’t find variable: babelHelpers" error after build.

The Polymer CLI version that I use is 1.1.0.

EDIT: I was using polymer-cli locally. After installing latest polymer-cli globally, now I get “Constructor requires ‘new’ operator” on safari and “Failed to construct ‘HTMLElement’: Please use the ‘new’ operator, this DOM object constructor cannot be called as a function.” on chrome.

EDIT2: used webcomponents-loader.js instead of webcomponents-lite.js and my problem solved.

回答1:

I was getting same error. Problem was that index.html is technically my entrypoint in my polymer.json config, but my actual served up entrypoint is another file that comes from my server (_Layout.cshtml since I'm using .NET on my backend). What I needed to do was take the code in my compiled index.html file and move it over to my CSHTML file once I set "compile": true. Problem solved.