Skip to content

Instantly share code, notes, and snippets.

@mtorre4580
Last active March 8, 2023 01:36
Show Gist options
  • Save mtorre4580/35558a723d437a73ca404bafe22a71ae to your computer and use it in GitHub Desktop.
Save mtorre4580/35558a723d437a73ca404bafe22a71ae to your computer and use it in GitHub Desktop.
Example to add external react and react-dom library in Next.js using CDN
module.exports = {
webpack: (config, options) => {
const { isServer, webpack } = options;
if (isServer) {
// Use the react from node_modules
} else {
config.externals = {
react: 'React',
'react-dom': 'ReactDOM',
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment