Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using router with rollup causes error #141

Closed
dpa99c opened this issue Feb 14, 2020 · 1 comment
Closed

Using router with rollup causes error #141

dpa99c opened this issue Feb 14, 2020 · 1 comment
Assignees

Comments

@dpa99c
Copy link

dpa99c commented Feb 14, 2020

I'm having a problem getting the Riot Router to work with rollup.

Here's the steps to reproduce the issue using the rollup example:

Clone the examples and install dependencies for rollup example:

git clone https://github.com/riot/examples && cd examples/rollup
npm install

Add router module:

npm i -S @riotjs/route

Edit src/app.riot to add router code:

<app>
  <h1>Hi Riot!</h1>
  <md content={ content } />
  <router>
    <nav>
      <a href="/home">Home</a>
    </nav>
    <route path="/home">
      Home page
    </route>
  </router>

  <script>
    import Md from './md.riot'
    import {Router, Route} from '@riotjs/route'

    const name = 'Rollup'

    export default {
      components: {
        Md,
        Router,
        Route
      },
      content: `Hello **${ name }**!`
    }
  </script>

  <style>
    :host {
      --riot-color: #f04;
      display: block;
    }
    h1 {
      color: var(--riot-color);
      border-bottom: 1px solid var(--riot-color);
    }
  </style>
</app>

Rebuild and run:

npm run build && npm run server

Observe the router elements fail to render and the following error in JS console:

bundle.js:8446 Uncaught TypeError: Cannot destructure property 'slots' of 'undefined' as it is undefined.
    at bundle.js:8446
    at callOrAssign (bundle.js:1412)
    at bundle.js:1821
    at getTag (bundle.js:1063)
    at Object.update (bundle.js:1132)
    at Object.mount (bundle.js:1119)
    at bundle.js:1320
    at Array.forEach (<anonymous>)
    at Object.mount (bundle.js:1320)
    at Object.mount (bundle.js:2012)	   

Test environment is Windows 10 and browser Chrome 80.

@GianlucaGuarini
Copy link
Member

The @riotjs/route depends on the lates Riot.js version 4.8.9 I have updated the example dependencies. There are no bugs you were using only an older riot version not compatible with the router

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

No branches or pull requests

2 participants