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

Transpile and build one distributable #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Joxtacy
Copy link

@Joxtacy Joxtacy commented Oct 18, 2019

Add webpack and babel to transpile and build into one distributable
file.
This also minifies the bundle.

Changes

Moved index.js and emojilib.json to src/.
Added webpack to build into a bundle and babel to transpile.
Bundle is in dist/index.js.
Points main in package.json to dist/index.js.

Task #1

Add webpack and babel to transpile and build into one distributable
file.
This also minifies the bundle.
@Joxtacy
Copy link
Author

Joxtacy commented Oct 18, 2019

@radmen
Please take a look at this and let me know what you think. Is this what you wanted? If not, let me know what I can do better. :)

@Joxtacy
Copy link
Author

Joxtacy commented Oct 18, 2019

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.

Copy link
Contributor

@radmen radmen left a 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/ the build: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",
Copy link
Contributor

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',

@radmen
Copy link
Contributor

radmen commented Oct 19, 2019

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.

@Joxtacy
Copy link
Author

Joxtacy commented Oct 23, 2019

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.
And thanks for your input on this! I guess I needed the clarification. :)

@radmen
Copy link
Contributor

radmen commented Oct 23, 2019

No worries, everything is fine :)

Thanks for the help!

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