Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

SyntaxError: import declarations may only appear at top level of a module #1122

Open
6 tasks
creativeautomaton opened this issue Jun 29, 2018 · 3 comments
Open
6 tasks

Comments

@creativeautomaton
Copy link

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

  1. polymer init

  2. choose the prrl pattern app with navigation

  3. npm install

  4. polymer serve

  5. get error message.

Browsers Affected

  • Chrome
  • Edge
  • Firefox
  • IE 11
  • Safari 8
  • Safari 9
@keanulee
Copy link
Contributor

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.

@ruckc
Copy link

ruckc commented Feb 15, 2019

@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.

@keanulee
Copy link
Contributor

FF still doesn't support dynamic import - https://caniuse.com/#feat=es6-module-dynamic-import

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants