Open mikevalstar opened 4 years ago
Hi @mikevalstar , thank you for your feature request!
I just added support for yarn2 pnp, but we must add runtime dependencies like this:
{
"dependencies": {
"@babel/core": "^7.10.3",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-object-rest-spread": "^7.10.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-react-jsx": "^7.10.3",
"@babel/plugin-transform-runtime": "^7.10.3",
"@babel/preset-env": "^7.10.3",
"@babel/preset-react": "^7.10.1",
"@babel/preset-typescript": "^7.10.1",
"@babel/runtime-corejs3": "^7.10.3",
"@react-ssr/core": "latest",
"@react-ssr/express": "latest",
"babel-plugin-css-modules-transform": "^1.6.2",
"babel-plugin-react-require": "^3.1.3",
"express": "^4.17.1",
"lz-string": "^1.4.4",
"pnp-webpack-plugin": "^1.6.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"urlsafe-base64": "^1.0.0"
},
"installConfig": {
"pnp": true
}
}
(Because react-ssr uses lots of babel configs and tricky server side rendering. (e.g. lz-string
))
Any ideas?
Because of this, I think pnp
is currently not supported with NEXT.js
If you have some time, please try examples/support-yarn2-pnp
:)
Another way is to use @react-ssr/core@^0.24.0
and @react-ssr/express@^0.24.0
(or @react-ssr/nestjs-express@^0.24.0)
👍
amazing; works great. (I am and was using @react-ssr/express)
I am getting an error/warning when booting (this does not cause any bad effects, but thought I would point it out)
ERROR in ./react-ssr-src/entry-index.jsx Module not found: Error: Can't resolve '/Users/mikevalstar/projects/abc/.yarn/$virtual/@react-ssr-core-virtual-58ce43c274/0/cache/@react-ssr-core-npm-0.24.0-9e73bff365-698deb1492.zip/node_modules/@react-ssr/core/dist/development/app.js' in '/Users/mikevalstar/projects/abc/react-ssr-src' @ ./react-ssr-src/entry-index.jsx 6:0-217 16:51-54
They are changing how they do dependencies in yarn 2 so I think adding the runtime dependencies like you have done is correct. This is still one of the major working items with Yarn 2 as far as I have been following.
https://dev.to/arcanis/introducing-yarn-2-4eh1#deprecating-bundle-dependencies
I actually dont use Next.js for any of my current projects but they did put support into their roadmap: https://github.com/vercel/next.js/milestone/22?closed=1
As a bit of an aside and background, the project(s) I'm currently working on are for a client that has a couple of issues that Yarn 2 solves:
So our ideal solution is to include the packages in the repo so the app can deploy and boot faster
As part of yarn 2 they are adding a new method of accessing dependencies: pnp
https://classic.yarnpkg.com/en/docs/pnp/ https://classic.yarnpkg.com/en/docs/pnp/getting-started
since you're using webpack this can be supported using
https://github.com/arcanis/pnp-webpack-plugin
Thanks