-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Include minified version of the es6 module #201
Comments
How about "dat.gui.min.mjs", using the future ".mjs" extension? :P |
I'm not sure I understand the value of adding a minified ES module to the distribution... the large majority of developers using ES modules are doing so within some build system that typically starts with un-minified source, then compiles away the
Could you explain the use case and issue further? You're trying to minify while keeping the file as an ES import, then importing it how? I guess I'm skeptical of the idea that just because minifying ES modules is error-prone, libraries should ship a pre-minified ES module in addition to all the other output targets by default... it seems like this is a tooling issue that minifiers should solve. But perhaps I've missed something. :)
If the |
TL;DR But it can't hurt to provide dat.gui.module.min.js for those of us who could use it. Details: This is also true for other modules. So the core of the repo is indeed a rollup es6 module, while the optional features (UI, plotting, data convolution etc) are offered as single modules. This is a team decision in which we refactor the model from the view. Thus the model is a rollup, and the the view can be part of a framework like React or a separate bundle/app of its own. We did this to promote separate modules/rollups for our large apps. Also, I do not use a task manager like webpack, gulp etc. I simply use npm run scripts. I do use Rollup, but not until the production steps and as a simple command line tool. This allows write & run development And, yes, any bundle comes both as a single rollup, and as a minified rollup. For small repos like yours and mine, it is questionable as to whether or not minifying is a win. But for three.module.js, for example, it is a huge win. |
Just to be clear, the import statement with a minified file is the same as non-minified. So for my sample models, this works:
I've been using uglify-es to minify recently. |
I think I'd prefer not to add another output to the dat.gui build — not that I don't think minifying is worthwhile in the case you describe, but that I don't think it should be part of a library distribution. The bugs in minification tools will be fixed as ES modules become more common. |
Could you include a minified version of dat.gui.module.js in the distribution? I realize dat.gui.module.min.js may be a long name but it would be a nice addition.
There may be an issue with minifiers and es6 format. I use https://github.com/Rich-Harris/butternut's squash command.
The text was updated successfully, but these errors were encountered: