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

export source for node and unminified for browser #151

Merged
merged 1 commit into from
May 13, 2020

Conversation

boneskull
Copy link
Contributor

Hi,

over at Mocha we're looking to add support for parallel testing (mochajs/mocha#4245), and I've chosen workerpool to help manage this for us.

I noticed when debugging that this project is shipping a .min.js file to Node.js users. This isn't necessary, and can make debugging awkward.

This PR changes the main export in Node.js to be the source entry point: src/index.js. I've added the browser field to point to dist/workerpool.min.js.

Also:

Those building browser apps will often do their own minification. For those apps which do not, it can make sense to ship a minified version--but it doen't need to be the main export. I have not changed the default browser export to dist/workerpool.js (which it likely should be) because it too needs a source map (pointing back to the files in src/), and I wasn't sure how to configure that in the gulpfile.

@boneskull
Copy link
Contributor Author

This could be a breaking change for some consumers who bundle workerpool and are not looking in the browser field for the entry point.

@josdejong
Copy link
Owner

Thanks for your PR Christopher, that sounds like an awesome feature. I use mocha in quite some projects and parallel testing would be great 👍 . There is almost a circular dependency then since workerpool also uses mocha 😄 , it's only a devDependency though so no problem.

I didn't know about not having to provide minified code, there is a bit too much going on in js bundling world to follow everything. Still have to catch up with ES6 modules and everything. I will take some time tomorrow to merge your PR and change the gulpfile to also generate a map file for the non-minified bundle, and then it's fine to point to the non-minified dist/workerpool.js from the browser field.

Will be a breaking change indeed so I can publish it as v6.0.0, hopefully tomorrow after testing from an external browser and node.js project.

@josdejong josdejong merged commit d403896 into josdejong:master May 13, 2020
@josdejong
Copy link
Owner

@boneskull I've published [email protected] containing the updated entry points in package.json.

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