lit-element page.js and parameters not working?
tamis-laan opened this issue · comments
I'm using lit-element in combination with page.js and I'm running into an error. The code below is a simplification of the code I'm working on:
import {LitElement, html, css, property, customElement} from 'lit-element'
@customElement('my-app')
export class myApp extends LitElement {
// Element properties
static get properties(){ return {page:{type:String}} }
// Constructor
constructor() {
super()
page('/', ()=>this.page='index')
page('/test/:id', ()=>{console.log('TRACE');this.page='test'})
page()
}
render() {
if(this.page === "index") {
return html`index`
}
if(this.page === "test") {
return html`test`
}
}
}
The route '/'
works fine and shows me index, however the route /test/abc
gives me the following error:
client.js:1 Uncaught SyntaxError: Unexpected token '<'
Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('http://localhost:3000/test/') with script ('http://localhost:3000/test/sw.js'): The script has an unsupported MIME type ('text/html').
Also the TRACE
is not logged in console.
Not sure if the error is relatable as my setup is far more complex then the example above. But maybe someone has experience using page.js and lit-element together and has run up to similar problems before?