File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 11import { defineConfig } from 'vite' ;
22
33export default defineConfig ( {
4+ // Ensure asset URLs are relative to the built module (not absolute at site root)
5+ base : './' ,
46 build : {
57 lib : {
68 entry : 'src/index.js' ,
@@ -10,14 +12,9 @@ export default defineConfig({
1012 } ,
1113 rollupOptions : {
1214 output : {
13- // Do NOT override entryFileNames so Vite uses lib.fileName for the entry
14- // Worker and other assets will still be emitted under assets/
15- assetFileNames : ( assetInfo ) => {
16- if ( assetInfo . name && assetInfo . name . includes ( 'worker' ) ) {
17- return 'assets/[name]-[hash][extname]' ;
18- }
19- return 'assets/[name]-[hash][extname]' ;
20- } ,
15+ // Keep assets under assets/; relative path is enforced by base: './'
16+ assetFileNames : 'assets/[name]-[hash][extname]' ,
17+ // Let Vite/rollup choose relative paths tied to the lib entry; no need to force chunks dirs
2118 } ,
2219 } ,
2320 sourcemap : true ,
You can’t perform that action at this time.
0 commit comments