ctrlplusb / react-universally

A starter kit for universal react applications.
MIT License
1.69k stars 243 forks source link

Babel error with ES6 arrow functions #407

Closed nzeugaa closed 7 years ago

nzeugaa commented 7 years ago

Hi, I'm using the next branch and I'm having an issue with arrow functions. The following error is displayed near arrow functions when trying to build : BabelLoaderError: SyntaxError: Missing class properties transform.

I've added babel-preset-stage-0 in package.json and replaced stage-3 by stage-0 in .babelrc and internal/webpack/configFactory. Do I missing something ? Thanks so much for all your work.

ctrlplusb commented 7 years ago

That should work fine although I wouldn't recommend going for stage-0 unless it's a very experimental project. You could just add the feature you wanted via the plugin:

yarn add babel-plugin-transform-class-properties -D --exact

Then add as plugin to the .babelrc and configFactory.

That should work.

ctrlplusb commented 7 years ago

I hope you managed to resolve this.

nzeugaa commented 7 years ago

@ctrlplusb I fixed it by moving stage-0 after es2015. But I will go on the way you have suggested by adding plugins instead. Thanks a lot.

PabloMarch commented 6 years ago

In my case I solved this problem removing the "env" config for last two bowsers:

{ "presets": [ "react", "es2015", "stage-0", ["env", { "targets": { "browsers": ["last 2 versions"] } }] ] }

Just using: { "presets": [ "react", "es2015", "stage-0"] }