Last active
March 8, 2023 01:36
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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