Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Is is better to use __webpack_public_path__ for search index url? #1344

Closed
liuwenzhuang opened this issue Aug 21, 2024 · 2 comments · Fixed by #1347
Closed

[Feature]: Is is better to use __webpack_public_path__ for search index url? #1344

liuwenzhuang opened this issue Aug 21, 2024 · 2 comments · Fixed by #1347

Comments

@liuwenzhuang
Copy link
Contributor

What problem does this feature solve?

My site static files is deploy to oss, and html files is render from a node.js server, so my config is like:

builderConfig: {
    output: {
      assetPrefix: `{{STATIC_PATH}}/`,
    }
}

and node.js server will replace {{STATIC_PATH}} placeholder to oss url when render, and I override __webpack_public_path__ to ensure dynamic files path is correct.

After deploy, the page's resource is ok, but the search json file's request url is like http://mysite.com/{{STATIC_PATH}}/static/search_index.json, not prefix with __webpack_public_path__.

What does the proposed API look like?

Maybe the __webpack_public_path__ prefix or assetPrefix prefix to search index url could be config?

@Timeless0911
Copy link
Collaborator

How you override __webpack_public_path__

@chenjiahan
Copy link
Member

@Timeless0911 __webpack_public_path__ can be overriden in the runtime code.

https://rspack.dev/api/runtime-api/module-variables#__webpack_public_path__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants