Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Add Babel Typecheck #36

Closed
RickWong opened this issue May 19, 2015 · 6 comments
Closed

Add Babel Typecheck #36

RickWong opened this issue May 19, 2015 · 6 comments
Assignees

Comments

@RickWong
Copy link
Owner

https://github.com/codemix/babel-plugin-typecheck

@RickWong RickWong self-assigned this May 19, 2015
@ericfong
Copy link

Hi, I think is off topic. But

When using "piping" + "babel/register" in my project,
The dev server restart (for about 0.5 to 1 second) after every changes that we make.

I think that is because piping "hot" reloading and babel slow compilation?
Will this make the compilation even slower?

@RickWong
Copy link
Owner Author

0.5 to 1 second is considered fast, for restarting node server-side :) "babel/register" allows us to write modern Javascript (ES5/6/7) and Babel Typecheck will allow static + runtime type checking, which prevents an entire class of bugs. So it's worth it. But you can turn it off.

Also, perhaps I should bring back the production build for the server, so Babel-transformations are pre-compiled for production.

@RickWong
Copy link
Owner Author

@ericfong Do you think webpack hot-loading for the server (https://github.com/webpack/hot-node-example) would be a faster solution?

@ericfong
Copy link

The problem of "piping" + "babel/register":
Step 1: file changed
2: restart
3: compile
4: finally can be used

If webpack way:
Step 1: file changed
2: compile
3: restart after compile (browser HMR is like that, not sure about server)
4: Can be used
Pros: faster?
Cons: stack trace is ... the friend of flux (fuXk)

Personally, I prefer faster.
SourceMap for node?

By the way, I use babel for jsx only. I am using iojs 2.0.
We only use es6 syntax that support natively by iojs.

@RickWong
Copy link
Owner Author

I'll have to experiment with server-side HMR. Never done that before. If you have the time, a Pull Request is welcome :)

@RickWong
Copy link
Owner Author

On-topic: I added Babel Typecheck plugin. It works quite well for regular functions et cetera but unfortunately doesn't support some ES6 syntax (class methods) yet.

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

No branches or pull requests

2 participants