Skip to content

Commit ec8c3fe

Browse files
committed
feat(rolldown): use dist/_libs for bundled dependencies
1 parent 8cfdcc9 commit ec8c3fe

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/builders/bundle.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,21 @@ export async function rolldownBuild(
9696
dir: outDir,
9797
format: "esm",
9898
entryFileNames: "[name].mjs",
99-
chunkFileNames: "_chunks/[name]-[hash].mjs",
99+
chunkFileNames: "[name].mjs",
100100
minify: entry.minify,
101+
advancedChunks: {
102+
groups: [
103+
{
104+
test: /node_modules/,
105+
name: (moduleId: string) => {
106+
const pkgName = moduleId.match(
107+
/.*\/node_modules\/(?<package>@[^/]+\/[^/]+|[^/]+)/,
108+
)?.groups?.package;
109+
return `_libs/${pkgName || "_libs_common"}`;
110+
},
111+
},
112+
],
113+
},
101114
};
102115

103116
await hooks.rolldownOutput?.(outConfig, res, ctx);

0 commit comments

Comments
 (0)