Skip to content

Commit 43368c9

Browse files
authored
[demo] Fix entry bundle names
This changes the names of the `import()` bundles from `index.[hash].js` to `{basic,react,nesting}.[hash].js`, where the first part of the name is the directory (in the case of an import for an `index.*` file.
1 parent dbf905f commit 43368c9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/vite.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ export default defineConfig(env => ({
2929
],
3030
build: {
3131
polyfillModulePreload: false,
32+
cssCodeSplit: false,
33+
rollupOptions: {
34+
output: {
35+
entryFileNames(chunk) {
36+
let name = chunk.name;
37+
if (chunk.facadeModuleId) {
38+
const p = posix.normalize(chunk.facadeModuleId);
39+
const m = p.match(/([^/]+)(?:\/index)?\.[^/]+$/);
40+
if (m) name = m[1];
41+
}
42+
return `${name}-[hash].js`;
43+
},
44+
},
45+
},
3246
},
3347
resolve: {
3448
extensions: [".ts", ".tsx", ".js", ".jsx", ".d.ts"],

0 commit comments

Comments
 (0)