-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade preset ES6/7 from create-react-app #9
base: master
Are you sure you want to change the base?
Conversation
@@ -5,9 +5,9 @@ | |||
"main": "./lib/index.js", | |||
"scripts": { | |||
"lint": "eslint .", | |||
"prepublish": "babel --out-dir ./lib ./src", | |||
"prepublish": "NODE_ENV=development babel --out-dir ./lib ./src", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why ? the prepublish should compile it for NPM (production like)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had an issue with babel
, not sure if it's just my machine, but it was complaining that I needed to pass an environment. I can look more into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you try removing it and trying it out on your machine? It looks like it is required for the preset update, it's pretty harmless, and I've tested it and verified the output code works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specifically:
Error: Using `babel-preset-react-app` requires that you specify `NODE_ENV` or `BABEL_ENV` environment variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, using NODE_ENV=production is probably what you want here
@@ -1,6 +1,5 @@ | |||
{ | |||
"presets": [ | |||
"es2015", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to upgrade things to the support the preset used by facebook incubator, it has 27k+ stars, so I think it's becoming very popular.
You can read more on it here:
https://github.com/facebookincubator/create-react-app/tree/master/packages/babel-preset-react-app
Now looking at it, I think it should read this instead of the words preset,
{
"presets": [
"react-app"
]
}
I'll look into this and update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, forgot to mention the main reason to move to this - this upgrade is required to use the javascript syntax used to cleanup and move away from .createClass
and towards static props and es6 classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
es2015 is a subset of the react-app preset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer the case, you might want to have react-app + use the babel-preset-env
@SamyPesse I updated to the latest preset, and also cleaned up some lint errors. There was nothing under
npm test
, so all I've done is verify that it works with rendering components on a page.