-
Notifications
You must be signed in to change notification settings - Fork 508
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
Request: Allow AMD builds #938
Comments
Yes the lack of code-splitting in UMD also impacts #367; upstream in rollup/rollup#3422 (comment) I was told it isn't currently supported as UMD lacks a way to load deps. I suppose the "ideas" mentioned there refer to the issues you linked. Could you provide a rationale for why you want AMD output support as opposed to ESM or CJS? Each of the current build options has some of there own nuances, such as ESM not having dev/prod split vs CJS and UMD not being able to code-split. Adding another format option may add some more complexity if it has its own nuances as well (though I believe AMD can be treated the same way as CJS) which therein adds a maintenance and potential breakage burden (like #367 and UMD's lack of code-split). |
Hi, thanks for your time @agilgur5
I agree with you, as for today ESM is well-supported, but sometimes (and in my specific scenario) we need to deliver libraries to some fair old codebase that is heavily based on AMD, UMD output do this trick very well, though I still use |
Gotcha, so basically just for legacy codebases. If your library does multiple formats (e.g. CJS, ESM, and AMD), how do you import AMD given the lack of ability to specify it in a For CJS, TSDX uses the A PR would be welcome for the simple version -- can see in #788 the place in the code that would need to be modified to add any new format (that and the Also, there are codemods to help convert AMD to ESM or CJS, e.g. |
Should we add iife? It's useful for building 3rd-party JS that is used in script tags (like embed widgets or analytics scripts) |
Current Behavior
UMD build doesn't support code-splitting and dynamic imports (rollup/rollup#3490, rollup/rollup#3491) due to Rollup current limitations, and tsdx cli don't accept the format option
amd
when creating build configSuggested Solution
Consider support AMD module format, or at least accept
amd
option, so we can customize the build output using thetsdx.config.js
Who does this impact? Who is this for?
This behavior impact who need an AMD compatible bundle and code-splitting support
Describe alternatives you've considered
For now, the only alternative to having an AMD compatible bundle with code-splitting is to use Rollup directly
The text was updated successfully, but these errors were encountered: