Stencil: ES5 Build error caused by checkIfURLIsSupported() in polyfills

Created on 13 Jan 2021  路  3Comments  路  Source: ionic-team/stencil

While building my react which requires es5 varitant, using buildEs5: 'prod', the build using uglifyjs-webpack-plugin breaks with the below error

In strict mode code, functions can only be declared at top level or immediately within another function.

Stencil version:

 @stencil/[email protected]

I'm submitting a:
[x] bug report

Current behavior:
The es5 variation of stencil core build references the polyfill file which causes a build system for es5 to break dues to strict mode configurations

Expected behavior:
The app in which the stencil is integrated should build fine after including stencil.

Other information:
After some digging around, this is caused by checkIfURLIsSupported() in the polyfills/index.js file. This can be fixed by converting checkIfURLIsSupported as a function expression. I am happy to put a PR if this can be a fix that solves the issue without hurting any other setup.

bug

All 3 comments

That sounds like a good fix. Looking forward to the PR 馃槃

Thanks, its up here @claviska

Thanks, fixed in #2799.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mitchellsimoens picture mitchellsimoens  路  3Comments

bekliev picture bekliev  路  3Comments

glemiere picture glemiere  路  3Comments

lcswillems picture lcswillems  路  3Comments

romulocintra picture romulocintra  路  3Comments