Skip to content

Commit 6786d06

Browse files
committed
build: hotfix
1 parent 9bbe655 commit 6786d06

File tree

3 files changed

+193
-29
lines changed

3 files changed

+193
-29
lines changed

build.config.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@ export default defineBuildConfig({
8383
);
8484
},
8585
rolldownOutput(config) {
86-
config.codeSplitting!.groups?.unshift(
87-
{
88-
test: /src\/build\/(plugins|virtual|\w+\.ts)/,
89-
name: "_build/common",
90-
},
91-
{ test: /src\/(utils)\//, name: "_chunks/utils" }
92-
);
86+
config.advancedChunks = {}; // force overide obuild config for lib chunks
87+
// config.advancedChunks!.groups?.unshift(
88+
// {
89+
// test: /src\/build\/(plugins|virtual|\w+\.ts)/,
90+
// name: "_build/common",
91+
// },
92+
// { test: /src\/(utils)\//, name: "_chunks/utils" }
93+
// );
9394
config.chunkFileNames = (chunk) => {
9495
if (chunk.name.startsWith("_")) {
9596
return `[name].mjs`;
@@ -100,6 +101,23 @@ export default defineBuildConfig({
100101
if (chunk.name.startsWith("libs/")) {
101102
return `_[name].mjs`;
102103
}
104+
if (chunk.moduleIds.every((id) => id.includes("node_modules"))) {
105+
const pkgNames = [
106+
...new Set(
107+
chunk.moduleIds
108+
.map(
109+
(id) =>
110+
id.match(
111+
/.*\/node_modules\/(?<package>@[^/]+\/[^/]+|[^/]+)/
112+
)?.groups?.package
113+
)
114+
.filter(Boolean)
115+
.map((name) => name!.split("/").pop()!)
116+
.filter(Boolean)
117+
),
118+
].sort();
119+
return `_libs/${pkgNames.join("+") || "_"}.mjs`;
120+
}
103121
if (chunk.moduleIds.every((id) => /src\/cli\//.test(id))) {
104122
return `cli/_chunks/[name].mjs`;
105123
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"consola": "^3.4.2",
7575
"crossws": "^0.4.3",
7676
"db0": "^0.3.4",
77-
"h3": "^2.0.1-rc.10",
77+
"h3": "^2.0.1-rc.11",
7878
"jiti": "^2.6.1",
7979
"nf3": "^0.3.5",
8080
"ofetch": "^2.0.0-alpha.3",
@@ -143,7 +143,7 @@
143143
"miniflare": "^4.20260114.0",
144144
"mlly": "^1.8.0",
145145
"nypm": "^0.6.2",
146-
"obuild": "^0.4.16",
146+
"obuild": "^0.4.17",
147147
"pathe": "^2.0.3",
148148
"perfect-debounce": "^2.0.0",
149149
"pkg-types": "^2.3.0",

0 commit comments

Comments
 (0)