Closed mdaemon-technologies closed 3 months ago
Start a new pull request in StackBlitz Codeflow.
You need to set worker.rollupOptions.output.entryFileNames
.
https://stackblitz.com/edit/vitejs-vite-1irzjy?file=vite.config.js
That did work in the minimal reproduction. However, in my local build of 5.2.0 it did not work. What did work was moving the "worker" property above the "build" property in the vite.config.js file. Clearly, the location of the property should not matter.
before:
build: {
rollupOptions: {
output: {
assetFileNames: "web/assets/[name]-[hash].[ext]",
chunkFileNames: "web/assets/[name]-[hash].[ext]",
entryFileNames: "web/assets/[name]-[hash].js"
}
}
},
worker: {
format: "es",
rollupOptions: {
output: {
entryFileNames: `web/workers/[name]-[hash].js`,
}
}
},
output:
dist/assets/myworker-dxgnPMyq.js
after
worker: {
format: "es",
rollupOptions: {
output: {
entryFileNames: `web/workers/[name]-[hash].js`,
}
}
},
build: {
rollupOptions: {
output: {
assetFileNames: "web/assets/[name]-[hash].[ext]",
chunkFileNames: "web/assets/[name]-[hash].[ext]",
entryFileNames: "web/assets/[name]-[hash].js"
}
}
},
output:
dist/web/workers/myworker-rgRqI9cd.js
Describe the bug
Specifying
assetFileNames
andchunkFileNames
inworker.rollupOptions
does not affect the worker's output directory.I tested using the same stackblitz for v3, v4, v5. It does not appear to have ever been fixed, even though I found multiple closed duplicates.
Is there an additional library required?
Reproduction
https://stackblitz.com/edit/vitejs-vite-8bjpzf
Steps to reproduce
System Info
Used Package Manager
npm
Logs
Validations