rcu breaks on '/' char, TypeError: state is not a function
vujovicigor opened this issue · 4 comments
This nodejs script will break and return "TypeError: state is not a function" error:
var Ractive = require('ractive');
var rcu = require('rcu');
rcu.init(Ractive);
var a = rcu.parse(`<script>
component.exports ={
onrender: function ( options ) {
var aa= 2 / 3;
}
,computed:{
paginationbuttons:function()
{
return 1/2;
}
}
}
</script>`);
console.log(a);
but if you add one more '/' it will work!:
var Ractive = require('ractive');
var rcu = require('rcu');
rcu.init(Ractive);
var a = rcu.parse(`<script>
component.exports ={
onrender: function ( options ) {
var aa= 2 / 3;
var aa= 2 / 3;
}
,computed:{
paginationbuttons:function()
{
return 1/2;
}
}
}
</script>`);
console.log(a);
It will break if you have odd total number of '/' chars in template.
This was caused by an upstream bug, since fixed – can you try installing the edge
version (npm i rcu@edge
) and checking that it's fixed please? Thanks
I just tried edge (rcu@0.8.2), same error :(
_/home/ubuntu/nodes/webpack/node_modules/rcu/dist/rcu.umd.js:453
state = state(str[i], i);
^
TypeError: state is not a function
at find (/home/ubuntu/nodes/webpack/node_modules/rcu/dist/rcu.umd.js:453:12)
at match (/home/ubuntu/nodes/webpack/node_modules/rcu/dist/rcu.umd.js:474:15)
at Object.parse (/home/ubuntu/nodes/webpack/node_modules/rcu/dist/rcu.umd.js:623:4)
at Object. (/home/ubuntu/nodes/webpack/test.js:5:14)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module.load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:141:18)
That's weird, edge
should be a greater version. Try rcu@0.9.0-edge1
?
It work with rcu@0.9.0-edge1 and ractive@0.8
Thanks :)