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
BUG report and Feature request: Support AMD bundling with preserveModules on file(bundle.js) #2784
Comments
Hi @izelnakri, thanks for this issue. So with your proposal, I am not sure this is easily supportable as this would be a completely new rendering mode (i.e. concatenating everything) but something that is theoretically possible. Nevertheless my feeling is that this would make more sense to be solved by a plugin, at least the concatenation part, or do you see any issues here? The I assume that is the reason why you classified this as a bug, though my understanding is that when using one file per module, these ids are not needed and possibly even discouraged. But I see that there are several possible approaches here:
In any case something else I noticed is that we should probably remove the |
thanks for the quick response @lukastaegert! yes file only makes sense for AMD and SystemJS definitions. I agree that concatenation would be more challenging, first ideal step would be to adjust the I would like to use I'll look into the API's you've mentioned perhaps I can build something on it whenever I find time, meanwhile please let me know if there are any updates/PR from you. Thanks again for the library and your consideration! |
The point is, Rollup itself also requires maintenance. If I spend time maintaining things that could be maintained by others then this will prevent other core features from being developed. By proposing to build a plugin I am also proposing that I will not be the one building the plugin, and at the moment I am more or less the core team. But I will be very happy to support you in any way I can because then it will be a net win for the whole ecosystem. I hope I will find some time soon to look into the core issues I listed, mainly a way to add amd ids and probably have another look at file extensions. |
Piggybacking on this discussion: The power to give output AMD modules IDs programmatically would definitely be quite useful. I had a case where I would've wanted to give n input modules to Rollup, have Rollup then bundle these together into single AMD modules as much as possible while splitting into chunks any common imports between the input modules, and have all of these modules then follow some naming scheme eg. |
I'm going to contact the author to see if they'd be cool with brining rollup-plugin-node-globals into the Rollup org so that it can be kept up to date. |
Please have a look at the discussion in #2881. There was at least work on an alternative plugin by @manucorporat but I do not know what the current state is |
As for the original issue, as AMD ids are broken anyway for code-splitting, may Plan would be to
|
Feature Use Case
Currently rollup acts as an advanced bundler(static + npm import resolver across multiple files, treeshaking, sourcemaps) and module formatter/transpiler(cjs <-> amd <-> iife etc), it also serves a very nice plugin system. Recently it seems
experimentalPreserveModules
became stable, however it misses preserving modules on a single file bundles([dir | file ] -> bundle.js
), in fact currently rollup throws an error ifpreserveModules
gets used without adir
configuration or used withfile
configuration.I think this is an important feature that opens up new possibilities for rollup(for example, it can allow rollup to be the default
packager
for the next generation ember-cli) and most work seems to be already done. When a user selectspreserveModules
withdir
, rollup can correctly lookup the dependency graph and transpile files and dependencies to the target module format, while doing so however it also misses moduleNames for each AMD module:preserveModules: today:
===========
AFTER:
rollup -c
:Feature Proposal
For
preserveModules
withfile: 'bundle.js'
. Given:Result should be:
The text was updated successfully, but these errors were encountered: