Skip to content

Conversation

@sachin-hg
Copy link

Sometimes it's required to modify the publicPath while taking the defaultPublicPath as a parameter

Usecase: Multiple webpack builds on same page: and defaultPublicPath for each is something like: //mydomain.com/static/<APP_NAME>/ now I need to change it to //myOtherDomain.com/static/<APP_NAME>/

therefore, if I use the plugin like so:

new WebpackRequireFrom({methodName: 'get_public_path'})

and have get_public_path defined like so:

window.get_public_path = defaultPublicPath => defaultPublicPath.replace('myDomain', 'myOtherDomain')

I would be able to achieve it for all apps

Sometimes it's required to modify the publicPath while taking the defaultPublicPath as a parameter

Usecase: Multiple webpack builds on same page: and defaultPublicPath for each is something like: //mydomain.com/static/<APP_NAME>/
now I need to change it to //myOtherDomain.com/static/<APP_NAME>/

therefore, if I use the plugin like so:

new WebpackRequireFrom({methodName: '__get_public_path__'})

and have __get_public_path__ defined like so:

window.__get_public_path__ = defaultPublicPath => defaultPublicPath.replace('myDomain', 'myOtherDomain')

I would be able to achieve it for all apps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant