Skip to content

Add a build step to transpile ES6 -> ES5 - #9

Closed
rreusser wants to merge 1 commit into
Philmod:masterfrom
rreusser:master
Closed

rreusser wants to merge 1 commit into
Philmod:masterfrom
rreusser:master

Conversation

@rreusser

@rreusser rreusser commented Aug 18, 2016 •

Copy link
Copy Markdown

See: #8
cc: @nattelog

Long story short, I was unable to use this module out of the box because my project didn't otherwise have any use for a ES6 build step. I could add one, but I generally think it's nicer for a casual dependency not to force it. I apologize for the change in line endings (I can try to undo that if you prefer cleaner git history), but the only changes are:

  • adds build directory lib/ to .gitignore
  • adds source directory src/ to .npmignore
  • changes entry point to lib/index
  • adds a prepublish step that builds and tests
  • adds necessary dev dependencies to get everything to work out of the box

I know this is an opinionated PR so you're absolutely free to disregard this, no hard feelings; this is just me voicing a preference without just +1'ing the issue. 😄

Thanks for the great module!

@rreusser rreusser mentioned this pull request Aug 18, 2016
@rreusser

rreusser commented Aug 18, 2016 •

Copy link
Copy Markdown
Author

Update: added babelify + es2015 to my demo (normal fresnel reflection!—used it to smooth out the control interactions 😄). I still lean toward a build step, but I'll leave the ball in your court on whether to accept/reject.

@Philmod

Philmod commented Aug 18, 2016

Copy link
Copy Markdown
Owner

Hey,

If you change the entrypoint to compiled lib/index.js, will that still work if you import that npm module in a node.js application?

I don't believe this module should be compiled in any form. The application that uses it should take care of that.

Your demo looks really cool!

@rreusser

rreusser commented Aug 18, 2016 •

Copy link
Copy Markdown
Author

That's fair. 👍

The specific point of failure for me is that uglifyjs fails when it encounters class, so that the only option is transpiling. Which isn't a big deal. Everyone transpiles these days; just wasn't convinced it should be mandatory. I'm using a custom budo dev server, so just had to add some transpiling configuration. I can see an argument for both sides, but I'm perfectly happy. Thanks!

@rreusser rreusser closed this Aug 18, 2016
@rreusser

rreusser commented Aug 18, 2016 •

Copy link
Copy Markdown
Author

Oh, sorry. I didn't answer your question. Yes, if the entry point is lib/index.js and that's in the node module but not the git repo, it'll work from node.js. (I've used that approach to avoid either the node module or the git repo having two different versions of the same code. The node module has the compiled version and the git repo has the source; no overlap)

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.

2 participants