polymer-starter-kit
polymer-starter-kit copied to clipboard
SyntaxError: import declarations may only appear at top level of a module
Description
The switch import on the _pageChanged(page) function that controls routing seems to be broken.. I recieve a ' SyntaxError: import declarations may only appear at top level of a module ' in my error console and the app breaks. This is from my app but also a clean install of the prrl pattern polymer app using polymer-cli init.
Expected outcome
routing should have worked but this error happens?
Actual outcome
app breaks and not routing occurs. only index.html is loaded.
Live Demo
Steps to reproduce
-
polymer init
-
choose the prrl pattern app with navigation
-
npm install
-
polymer serve
-
get error message.
Browsers Affected
- [ ] Chrome
- [ ] Edge
- [ ] Firefox
- [ ] IE 11
- [ ] Safari 8
- [ ] Safari 9
What browser and what version of the CLI are you using? Dynamic import()
statements require browser support, but the latest polymer-cli (polymer serve
) will covert them to AMD modules if the request comes from a browser with no support.
@keanulee I just ran into this today with the starter-kit, for me, its post-build (i'll try to convert them to AMD modules) but the my browser is the current Firefox ESR 60.x.
FF still doesn't support dynamic import - https://caniuse.com/#feat=es6-module-dynamic-import