Skip to content

Commit 627d837

Browse files
authored
Merge pull request #132 from preactjs/demo-fix-entry-names
[demo] Fix entry bundle names
2 parents 602f9b8 + d701270 commit 627d837

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.github/workflows/compressed-size.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
with:
2222
pattern: '{packages/*/dist/!(*.module|*.min).{js,mjs},docs/dist/**/*.{js,css}}'
2323
build-script: 'ci:build'
24-
strip-hash: "\\.(\\w{8})\\.(?:js|css)$"
24+
strip-hash: "[.-](\\w{8,9})\\.(?:js|css)$"
2525

docs/vite.config.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig, Plugin, Connect } from "vite";
22
import preact from "@preact/preset-vite";
3-
import { resolve } from "path";
3+
import { resolve, posix } from "path";
44
import fs from "fs";
55

66
// Automatically set up aliases for monorepo packages.
@@ -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)