Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pyramation
Copy link
Contributor

@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.

@@ -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",
Copy link
Owner

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)

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link

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",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ?

Copy link
Contributor Author

@pyramation pyramation May 22, 2017

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants