kbrsh/moon-router

Uncaught TypeError: Cannot read property 'length' of undefined

Closed this issue · 1 comments

oBusk commented

I'm trying to get a basic example with moon-router working but I'm only getting:

Uncaught TypeError: Cannot read property 'length' of undefined
    at createNodeFromVNode (moon.js:376)
    at hydrate (moon.js:725)
    at hydrate (moon.js:778)
    at Moon.patch (moon.js:2038)
    at Moon.build (moon.js:2068)
    at Moon.mount (moon.js:2000)
    at Moon.init (moon.js:2079)
    at Moon.init (moon-router.js:179)
    at new Moon (moon.js:1770)
    at Object.module.exports (main.js:21)

The basic example I'm attempting is

Moon.use(MoonRouter);

Moon.component('app-root', {
    template: '<p>Root component!</p>',
});

Moon.component('app-hello', {
    template: '<p>Hello component!</p>',
});

const router = new MoonRouter({
    default: '/',
    map: {
        '/': 'app-root',
        '/hello': 'app-hello'
    }
});

const app = new Moon({
    el: '#app',
    router: router,
    data: {
        text: 'Hello router!',
    },
});
<div id="app">
    <p>{{ text }}</p>

    <router-view></router-view>
</div>
kbrsh commented

Whoops! Thanks for the error, this was fixed already but I didn't release the new version. Fixed in v0.0.5.