Automatic Updating of the main property of package.json #19731
-
DescriptionWhen vite builds for production, it postfixes a random string to the end of the bundle. It would be nice if we could configure vite to automatically update the Suggested solutionIt's possible to make the bundle name fixed, but that has a few drawbacks. AlternativeFixed bundle file name configuration. Additional contextValidations
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This sounds like too niche deployment scenario, so I don't think Vite would support such mechanism builtin. That said, you should be able to achieve the same by writing own script before release to update package.json manually maybe by looking up https://vite.dev/config/build-options.html#build-manifest. Please provide an minimal example project to show your current setup if you need a further help. Actually, for unpkg use case, it should be probably fine to have a fixed bundle name since unpkg will add the version suffix and that should serve as cache busting, for example, https://unpkg.com/slash is redirected to https://unpkg.com/slash@5.1.0/index.js. |
Beta Was this translation helpful? Give feedback.
This sounds like too niche deployment scenario, so I don't think Vite would support such mechanism builtin. That said, you should be able to achieve the same by writing own script before release to update package.json manually maybe by looking up https://vite.dev/config/build-options.html#build-manifest. Please provide an minimal example project to show your current setup if you ne…