-
Notifications
You must be signed in to change notification settings - Fork 2
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
Transpile and build one distributable #4
base: master
Are you sure you want to change the base?
Conversation
Add webpack and babel to transpile and build into one distributable file. This also minifies the bundle.
@radmen |
And I just realised that I broke the Travis build. Not sure what I can do about that. Will look into it as soon as I can though. |
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.
Thank you for this MR. I really appreciate it!
I've noticed a couple of things:
- I'm not able to
require
the generated bundle in the Node env (didn't test it in the browser)- most likely this is the reason why the tests failed
- by moving the files to
src/
thebuild:emojislib
script is broken - I'd like to keep the original index file as a
main
entrypoint for the package. The dist files are meant to be used in environments which can't consume the original source file.
index: path.join(__dirname, "src/index.js") | ||
}, | ||
output: { | ||
filename: "[name].js", |
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 should be a UMD export.
Adding this lines should be enough:
library: 'munci',
libraryTarget: 'umd',
Out of curiosity, I've checked how Webpack makes the UMD builds. Apparently, this is bugged and such build can't be used in the Node env. Fortunately, there are some workarounds for that. |
Sorry. I've been really busy lately with work. But I'll get back on this again by the weekend. Sorry for letting you wait. |
No worries, everything is fine :) Thanks for the help! |
Add webpack and babel to transpile and build into one distributable
file.
This also minifies the bundle.
Changes
Moved
index.js
andemojilib.json
tosrc/
.Added webpack to build into a bundle and babel to transpile.
Bundle is in
dist/index.js
.Points
main
inpackage.json
todist/index.js
.Task #1