-
How do I rename the generated CSS files to include the package version? I was able to rename the JS files by creating a Vite plugin and using the outputOptions(options) {
return {
...options,
assetFileNames: options.assetFileNames.replace('[hash]', `[hash]-v${pkg.version}`),
chunkFileNames: options.chunkFileNames.replace('[hash]', `[hash]-v${pkg.version}`),
entryFileNames: options.entryFileNames.replace('[hash]', `[hash]-v${pkg.version}`),
}
} We're doing this because we've had some issues with Cloudflare returning 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
For future reference, I was able to successfully rename all assets by replacing the above hook with: config(config) {
config.build.rollupOptions.output.assetFileNames =
config.build.rollupOptions.output.assetFileNames.replace('[hash]', `[hash]-v${pkg.version}`)
config.build.rollupOptions.output.chunkFileNames =
config.build.rollupOptions.output.chunkFileNames.replace('[hash]', `[hash]-v${pkg.version}`)
config.build.rollupOptions.output.entryFileNames =
config.build.rollupOptions.output.entryFileNames.replace('[hash]', `[hash]-v${pkg.version}`)
return config
} I've also included these to the plugin's configuration ( apply: 'build',
enforce: 'post', |
Beta Was this translation helpful? Give feedback.
For future reference, I was able to successfully rename all assets by replacing the above hook with:
I've also included these to the plugin's configuration (
post
is needed so that it kicks in after SvelteKit h…