VulcanJS / vulcan-npm

The full-stack JavaScript App Framework
https://vulcan-docs.vercel.app
MIT License
31 stars 8 forks source link

Clean handling of several versions of React - yarn link of node modules with Lerna #5

Closed eric-burel closed 2 years ago

eric-burel commented 4 years ago

This concerns the development environment, when one want to test the local version of Vulcan NPM in a Vulcan app.

https://github.com/facebook/react/issues/13991 https://github.com/facebook/react/issues/14257 https://stackoverflow.com/questions/34706817/how-prevent-multiple-copies-of-react-from-loading https://next.material-ui.com/getting-started/faq/#duplicated-module-in-node-modules https://robkendal.co.uk/blog/2019-12-22-solving-react-hooks-invalid-hook-call-warning

Using npm link or yarn link on Lerna packages ends up loading 2 versions of React and React Dom. We might avoid this by making React and React DOM peer dependencies, or using more robust commands in Vulcan Next

Current fix:

Alternative: using Webpack but that's not good.

Possible solution: Allow to pass a VULCAN_PACKAGE_DIRS env variable like we did in Meteor and handle yarn link ourselves, so the end user doesn't need to know it.

eric-burel commented 3 years ago

yalc seems to have been proposed as a solution https://www.npmjs.com/package/yalc. Also hitting this bug with Next.js Webpack versions...

eric-burel commented 3 years ago

Sister issue in Vulcan Next: https://github.com/VulcanJS/vulcan-next/issues/104, that would provide an efficient solution.