Skip to content

Commit fba43e4

Browse files
fix(enhanced): support get public path
1 parent 713b684 commit fba43e4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/website-new/docs/en/configure/getpublicpath.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
In the example below, `getPublicPath` is set. When other consumers load this provider, the code for `getPublicPath` will be executed using `new Function` to obtain the return value. The content of the return value will be used as the `publicPath` prefix for the static resources of the module.
1111

12+
:::tip NOTE
13+
```getPublicPath``` Must be a function as a string.
14+
:::
15+
1216
```ts title="rspack.config.ts"
1317
module.exports = {
1418
plugins: [
@@ -18,7 +22,7 @@ module.exports = {
1822
'./Button': './src/components/Button.tsx',
1923
},
2024
// ...
21-
getPublicPath: `return "https:" + window.navigator.cdn_host + "/resource/app/"`,
25+
getPublicPath: `function(currentPath) {return "https:" + window.navigator.cdn_host + "/resource/app/"}`,
2226
}),
2327
],
2428
};

0 commit comments

Comments
 (0)