Automatically use package.json's dependencies for rollupOptions.external when in lib mode
#10582
Shinigami92
started this conversation in
Ideas
Replies: 1 comment
-
|
In that case, I think we need to phase out UMD support in library mode by default too. It's not supported when using multiple entries anyway #10315 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I switched some of my projects from using
tscto build withviteso I can benefit from a nice CLI output and bundlingcjs,es(m)anddtsWhile doing that I found out that I need to configure
build > rollupOptions > externalto contain thepackage.json'sdependenciesso they don't get bundled inside thedist's content.IMO this should be the default behavior so we don't need to explicitly configure that.
Changing this would result in a breaking change, so if we want that nice-to-have, it must be published in a new major version.
I can think of that if
build > lib > entryis set to a value andbuild > rollupOptions > externalisundefined, then use dependencies array as default value forexternal.We will still have the possibility to change the behavior in our configs by overriding that default behavior by just configure
externalon demand.Some things I found while searching through already existing issues / discussions in Vite Repo:
rollup-plugin-node-externals, but I don't want to install a plugin, because the goal is to reduce the config for default behavior.Off-Topic extra thought: Might it be possible to extract
library-modecompletely out of Vite's Core and just provide a plugin? 👀vitestalready somehow changed and opt-in to Vite'sdefineConfigto provide the option propertytest. Maybe we can add via the same way support forbuild > lib🤔Edit: started with an implementation
Beta Was this translation helpful? Give feedback.
All reactions