-
-
Notifications
You must be signed in to change notification settings - Fork 26.6k
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
__webpack_public_path__ does not work? #6024
Comments
Can you be more specific about what you're trying to accomplish? It sounds like PUBLIC_URL is really what you're after. |
I konw the PUBLIC_URL works well when i want to set cdn path to script & link tags in html files produced by htmlwebpackplugin,the reason why i change to use webpack_public_path is that:
Why i want webpack_public_path instead of publicPath( PUBLIC_URL ) is that i want to set dynamically at runtime 。 I enconter a react-snap#issue-182410449 my code example : src/index.html` src/publicPath.js
but the output file is not in my expectation :
i expect it can be build like:
|
In your example are you showing us the outputted index.html? Or are you showing a lazy loaded css chunk that is injected at runtime? |
Here is my repository ,npm run prod && npm run snapbuild , then checkout the build directorty, the script and link tags in html files does not contain my cdn path (defined in /src/publicPath.js using __webpack_public_path__ ) |
Gotcha. Thanks for the repository. I think there may be some confusion between
Does that help clear things up? |
@ianschmitz thank you for you patience,it was not a CRA issue but my misunderstanding , now i can fix my project by adding a webpack plugin。 thanks a lot , thank you !!! 😄 |
Is this a bug report?
yes
I want to set html files assetsPath in dist directory produced by htmlwebpackplugin at runtime, so I tried to figure out
__webpack_public_path__ = "http://cdn.mydomain.com
instead of setting publicUrl , but it doesnot work at all。 how can i set publicPath at runtime ? does not webpack_public_path support in CRA?The text was updated successfully, but these errors were encountered: