web-maker icon indicating copy to clipboard operation
web-maker copied to clipboard

JS decorator support

Open instrumaniak opened this issue 8 years ago • 1 comments

Hi! I am getting errors while running js decorators (running mobx example codes) in web maker..in the babel mode....would you please check whether JS decorator is enabled for babel inside web maker? Thanks!

instrumaniak avatar Jan 23 '18 07:01 instrumaniak

yeah think also that should be possible, think I've identified the line where to change the babel presets:

https://github.com/chinchang/web-maker/blob/master/src/script.js#L958-L960

stage-2 needs to be changed to stage-0 & adding transform-decorators-legacy to the plugins-section.

but anyway would be cool to have a way to configure the babel-presets anyway - or have a bit more influence on how the code is transpiled in any case.

code = Babel.transform(code, {
					presets: ['latest', 'stage-0', 'react'],
					plugins: ["transform-decorators-legacy"]
				}).code;

the code above would do it - but i ran into esprima issues - so i think

marsch avatar May 25 '18 06:05 marsch