Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

babel-node is not recommended for production #48

Open
vasco3 opened this issue Sep 24, 2015 · 20 comments
Open

babel-node is not recommended for production #48

vasco3 opened this issue Sep 24, 2015 · 20 comments

Comments

@vasco3
Copy link
Contributor

vasco3 commented Sep 24, 2015

I just saw that babeljs docs advice against using babel-node on production like we are doing in https://github.com/cloverfield-tools/universal-react-boilerplate/blob/master/package.json#L7

ref. https://babeljs.io/docs/usage/cli/#babel-node

So should it be compiled to a bin/ dir and point the start script there?

@ericelliott
Copy link
Contributor

Yes, we should compile for prod. I typically compile to a build directory. I wrote a blog post on this topic:

How to Use ES6 for Universal JavaScript Apps

@vasco3
Copy link
Contributor Author

vasco3 commented Sep 26, 2015

What do you think of running it with PM2 after transpiling with babel?

@ericelliott
Copy link
Contributor

That's fine. =)

@ericelliott
Copy link
Contributor

I'm open to a PR to document production use, if you'd like to contribute. =)

@vasco3
Copy link
Contributor Author

vasco3 commented Nov 29, 2015

I'm trying to run the server but don't get anything served.

npm run build
npm run start # or npm run server

The app logs in the console that the server is running, but there is nothing served on the browser when I hit localhost:3000

Is that still work in progress?

@ericelliott
Copy link
Contributor

Probably. There is an outstanding PR request that adds more features here. Have you looked at that?

@ericelliott
Copy link
Contributor

At any rate, I'd love to accept a PR that displays the parsed README from the markdown for the homepage. =)

@vasco3
Copy link
Contributor Author

vasco3 commented Nov 30, 2015

Yeah I have seen the outstanding PR. I think I'll debounce my work on this issue until we get the app served to the browser.

@ericelliott
Copy link
Contributor

I'm trying to run the server but don't get anything served.

Interesting. I see "Your App" when I run it. =) Don't you?

$ curl http://localhost:3000

    <!doctype html>
    <html>
      <head>
        <title>Your App</title>
      </head>
      <body>
        <div id='root'><h1 title="Your App">Your App</h1></div>
        <script>
  var payload = {
    title: 'Your App'
  };
</script>
        <script src="/static/index.js"></script>
      </body>
    </html>

@vasco3
Copy link
Contributor Author

vasco3 commented Nov 30, 2015

ah, for some reason it doesn't work from my vagrant. I tried it in my local and it works thanksf

@ericelliott
Copy link
Contributor

Interesting... old version of Node?

@vasco3
Copy link
Contributor Author

vasco3 commented Nov 30, 2015

it is old.. 0.12.7
but it works if I curl inside vagrant. But not from outside. It only happens with this app. The other apps I can curl them from outside the vagrant box without problems. I'll keep digging into this.

@ericelliott
Copy link
Contributor

odd. Sounds like a vagrant thing. =)

@vasco3
Copy link
Contributor Author

vasco3 commented Dec 14, 2015

found it. It was the 'localhost', in https://github.com/cloverfield-tools/universal-react-boilerplate/blob/master/source/server/index.js#L18
Since I was using the IP of my vagrant box instead of localhost:3000
eg. http://192.168.33.10:3000/

@ericelliott
Copy link
Contributor

Want to PR, or is your problem solved? =)

@vasco3
Copy link
Contributor Author

vasco3 commented Dec 14, 2015

Yeah I can PR. I just wonder why was that 'localhost' there

@ericelliott
Copy link
Contributor

I don't think it's there for any particular reason.

@nkbt nkbt self-assigned this Dec 22, 2015
ericelliott added a commit that referenced this issue Jan 3, 2016
[#48] Set default dev host to 0.0.0.0 and allow to redefine NODE_HOST and NODE_PORT
@nkbt
Copy link
Contributor

nkbt commented Jan 3, 2016

Host fixed by 7b80d37

@nkbt nkbt closed this as completed Jan 3, 2016
@vasco3
Copy link
Contributor Author

vasco3 commented Jan 3, 2016

@nkbt this issue is related to running the app with node instead of babel-node. Nothing to do with the host

@nkbt
Copy link
Contributor

nkbt commented Jan 3, 2016

I thought we compile for prod, sorry

@nkbt nkbt reopened this Jan 3, 2016
@nkbt nkbt removed their assignment Jan 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants