rollupOptions.output.assetFileNames does not work
See original GitHub issueDescribe the bug
rollupOptions.output.assetFileNames
does not work.
I have the start project with changed config:
export default defineConfig({
plugins: [vue()],
build: {
rollupOptions: {
output: {
entryFileNames: `[name].js`, // works
chunkFileNames: `[name].js`, // works
assetFileNames: `[name].[ext]` // does not work for images
}
}
}
})
The result build structure looks so:
As you can see assetFileNames
option was ignored for logo.png
.
See the related bug: https://github.com/vitejs/vite/issues/378#issuecomment-789366197
Reproduction
yarn create @vitejs/app my-vue-app --template vue
and use the config above.
System Info
Node: 15.9.0
@vitejs/plugin-vue: ^1.2.1 => 1.2.1
vite: ^2.1.5 => 2.1.5
Before submitting the issue, please make sure you do the following
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Provide a description in this issue that describes the bug.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:12
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Vite - change ouput directory of assets - Stack Overflow
The output filenames are configured in Rollup with build.rollupOptions : Set output.assetFileNames to configure the asset filenames (for ...
Read more >rollup.js
During this step, Rollup will build the module graph and perform tree-shaking, but will not generate any output. On a bundle object, you...
Read more >Configuring Vite
Configuring Vite #. When running vite from the command line, Vite will automatically try to resolve a config file named vite.config.js inside project...
Read more >Vite not copying all static assets - Laracasts
build: { rollupOptions: { output: { assetFileNames(assetInfo) { const pathToFile ... I am not sure what the problem is and if it is...
Read more >macropygia/vite-plugin-imagemin-cache - Socket.dev
Dependencies have 4 critical issues. ... no need to use. This is prepared for complex settings in rollupOptions.output.assetFileNames .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nice! Thanks for testing
Maybe you can specify a different folder depending on the ext of the file? You should join chat.vitejs.dev if you aren’t there already, probably there are others that may have the same requirement to discuss with.
@patak-js Yes, it works! All files become with name as set in assetFileNames mask. Fonts css ico.
By the way, is it possible to put fonts to font folder? Fonts become as many files as usual and I prefer to put files to font folder and css and ico in root.