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

INL-1516: Allow customising of chunkLoadingGlobal for LoadablePlugin #155

Closed
wants to merge 1 commit into from

Conversation

samstradling
Copy link

Allow customising of chunkLoadingGlobal for LoadablePlugin.

Docs: https://github.com/gregberge/loadable-components/blob/main/website/src/pages/docs/api-loadable-webpack-plugin.mdx

Information and context: gregberge/loadable-components#701

We have a case where we're running multiple Webpack runtimes on the same page which both use Loadable. This change adds an optional chunkLoadingGlobal option to LoadablePlugin and loadableReady which namespaces jsonpFunction or chunkLoadingGlobal.

@jaysonwu991
Copy link

Or you can use this to limit loadable-component in just SSR mode: https://github.com/Skyscanner/backpack-react-scripts/blob/fork/packages/react-scripts/config/webpack.config.js#L41:

# https://github.com/Skyscanner/backpack-react-scripts/blob/fork/packages/react-scripts/config/webpack.config.js#L477
isSsr && require.resolve('@loadable/babel-plugin')

# https://github.com/Skyscanner/backpack-react-scripts/blob/fork/packages/react-scripts/config/webpack.config.js#L723
isSsr && new LoadablePlugin()

And it is safe to do this.

@olliecurtis olliecurtis deleted the customise-chunkLoadingGlobal branch October 10, 2023 13:37
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.

2 participants