Skip to content

Commit d3f845a

Browse files
committed
feat: throw error when publicPath is function
1 parent cf94373 commit d3f845a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/middleware.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ function createPublicPathGetter(compiler: Compiler) {
1818
const raw = compiler.options.output.publicPath || "/";
1919

2020
if (typeof raw === "function") {
21-
return (compilation?: Compilation) =>
22-
compilation ? compilation.getPath(raw) : raw({ hash: "XXXX" }, undefined);
21+
// FIXME: this is a temporary workaround and we may support raw as function in the future
22+
throw new Error(
23+
'"publicPath" cannot be a function in Rspack, which may cause deadlock issue, use string instead',
24+
);
25+
// return (compilation?: Compilation) =>
26+
// compilation ? compilation.getPath(raw) : raw({ hash: "XXXX" }, undefined);
2327
}
2428
if (/\[(hash|fullhash)[:\]]/.test(raw)) {
2529
return (compilation?: Compilation) =>

0 commit comments

Comments
 (0)