Closed tscok closed 8 years ago
what kind of error do you get?
do you use any type attribute on the script tags in your riot.js tags? because that caused some problem for me.
Regardless of whether I use type="babel"
on my script tags or not I get the same error:
ERROR in ./assets/js/tags/layout-page.tag
Module build failed: Error: SyntaxError: /Users/mikaelcarlsson/Documents/dev/annsjon/.: Unexpected token (4:14)
at Object.module.exports (/Users/mikaelcarlsson/Documents/dev/annsjon/node_modules/riotjs-loader/index.js:37:11)
@ ./assets/js/tags/site-main.tag 4:0-24
When I remove the function mentioned above it works :(
I can't find it right now, but I remember reading something about add() {...}
style functions not being possible to do in riotjs tags with es6. I think you have to use this.add = () => { ... }
Maybe you read that here: https://github.com/riot/examples/tree/gh-pages/es6
And you're right! I didn't realise I should use ES6 syntax with Babel 6. Thank you! :)
No problem! :)
As @nilpath suggested in #11 I too followed the steps on compiling with Babel 6 (http://riotjs.com/guide/compiler/#babel-6) without any luck.
I installed
babel-preset-es2015-riot
andbabel-core
and created the.babelrc
file at the project root. I have also added{ query: { type: 'babel' } }
to theriotjs-loader
. My webpack.config file is pretty much identical with the @esnunes example.I still get syntax errors for writing functions like
add() { ... }
. I just don't know where to start debugging. I'm quite new to webpack so I hope someone here can sort things out a bit :)Thanks!