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

Allow user to config publicPath of webpack and set its default value to auto #13642

Open
link89 opened this issue Aug 6, 2024 · 0 comments
Open

Comments

@link89
Copy link

link89 commented Aug 6, 2024

Is your proposal related to a problem?

It's popular to use CDN when deploy a web app to production, while in test stage the static assets are served with a file server or s3. In most case this can be done by building app multiple time with different PUBLIC_URL.

But there are some case that will need to change publicPath in the runtime.
One case is serving built vendor frontend assets without source code.
The typical case make me want this feature is streamlit and its compoments. Their frontend code is built with create-react-app and release the built assets in the installation packages, which make it hard to rebuild it with another PUBLIC_URL.

There are several issues related to this proposal.

Describe the solution you'd like

Currently, the webpack publicPath field is decided by PUBLIC_URL and it's hard to modify the webpack configuration.
In order to make it easier to apply CDN in the mentioned case,
I think create-react-app should provide another option (maybe WEBPACK_PUBLIC_PATH) to allow user to config publicPath independently, and its default value should be 'auto' instead of the value of PUBLIC_URL.

With this all it need to do to apply CDN for built frontend is to replace the href in all <link> and '<script>tags in theindex.html`.

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

No branches or pull requests

1 participant