stencil-community / stencil-router

A simple router for Stencil apps and sites
https://stenciljs.com/
MIT License
188 stars 55 forks source link

Hash historyType routing broken on ES5 builds #78

Open mariofriz opened 5 years ago

mariofriz commented 5 years ago

Stencil version: (run npm list @stencil/core from a terminal/cmd prompt and paste output below):

@stencil/core@0.15.1
@stencil/router@0.3.0

I'm submitting a ... (check one with "x") [ x ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com

Current behavior: When using stencil-router in hash historyType, application no longer works in Firefox / Edge / IE 11. It is working fine on Chrome which uses ES6 build and not ES5.

Expected behavior: Application should work on all browser with hash historyType.

Steps to reproduce:

Activate hash historyType:

<stencil-router historyType={'hash'}>
     <stencil-route-switch scrollTopOffset={0}>
          <stencil-route url='/' component='app-home' exact={true} />
          <stencil-route url='/profile/:name' component='app-profile' />
     </stencil-route-switch>
</stencil-router>

Compile using es5 flag to see errors and be able to test on other browsers than Chrome:

"scripts": {
    ...
    "start": "stencil build --dev --watch --serve --es5",
    ...
}

Following error is displayed in console: image

Related code:

Sample repo: https://github.com/mariofriz/stencil-app-starter

manucorporat commented 5 years ago

Might be related with https://github.com/rollup/rollup/issues/2570 ?