Skip to content

Instantly share code, notes, and snippets.

@nivrith
Created July 19, 2019 04:21
Show Gist options
  • Save nivrith/26bd62c93fcde37d0216e8260ca05e99 to your computer and use it in GitHub Desktop.
Save nivrith/26bd62c93fcde37d0216e8260ca05e99 to your computer and use it in GitHub Desktop.
Share same instance of module across multiple webpack entry points
// webpack config
{
// ....
optimization: {
runtimeChunk: {
name: 'commons' // ← Added to make sure the same instance of module exports is handed over to all bundles
}
}
}
@nivrith
Copy link
Author

nivrith commented Jul 19, 2019

In depth explanation on how this works: https://stackoverflow.com/a/56590271

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