-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Webpack PublicPath to be a function #9518
Description
Feature request
The documentation says that __webpack_public_path__ can be overwritten at runtime, something like __webpack_public_path__ = '/www.something.com/.
We could extend this feature by allowing it to be a function:
__webpack_public_path__ = chunk => `www.something.com/${chunk}`
What is the expected behavior?
this would allow webpack to load files from different public paths, depending on the requested chunk.
What is motivation or use case for adding/changing the behavior?
Avoiding unnecessarily client's cache invalidation, further information: https://stackoverflow.com/questions/57337716/webpack-publicpath-use-different-urls-to-reuse-bundles
How should this be implemented in your opinion?
__webpack_public_path__ as a function. It would retrieve the requested chunk as argument and return its absolute path.
Are you willing to work on this yourself?
yes