neutrino
neutrino copied to clipboard
Implement Yarn 2 support
Resolves https://github.com/neutrinojs/neutrino/issues/1277
- [x] Bump minimal Jest version to support Plug and Play
- [x] Add PnP middleware
- [x] Make sure all resolves are PnP compatible
- [x] Use PnP middleware in all presets
- [x] Adopt all ESLint presets as there are known problems with ESLint sharable configs and PnP
I can see in the build logs that the job published packages to NPM. But why? It even didn't pass the code formatting check. And this is only Pull Request.
I can see in the build logs that the job published packages to NPM. But why?
It's not a real NPM server - see: https://github.com/neutrinojs/neutrino/blob/master/scripts/test-create-project-ci.sh
Here are my thoughts. I have my personal set of Neutrino middlewares and presets for React, ESLint and other. I reuse couple of Neutrino core middlewares, but most are custom. I faced really a lot of problems with Yarn 2. Especially with ESlint. I resolved them. Some solutions were really hacky. So I decided to integrate my experience to the Neutrino core.
Lets discuss your points
- PnP will be supported in Webpack 5. This is true. Until this moment configuration need to use PnPPlugin. Some projects need this already today. Internally the plugin checks the PnP environment (Yarn documented how to do this) and enables necessary functionality on demand. Speaking simply it has no effect on NPM and PNPM projects. I also thought about conditionally enabling it but realized that it is easier to inspect Webpack Config when it is always included. This is how CRA and Storybook do - they always include PnPPlugin to configuration.
- I will document the integration of Jest and PnP. But please recommend me where to write "PnP" section
- I thought that Neutrino goal is to hide the config complexity from the consumer. That's why I decided that
react
andvue
presets should support this out of the box without thinking how to enable this. And according to the first point it should not affect the build process on NPM. Again, CRA does this. Also it is little easier to upgrade to Webpack 5 later. You will not need to edit.neutrinorc.js
Please, look at the new section in the documentation https://github.com/constgen/neutrino-dev/tree/pnp/packages/eslint#utility-functions
I think everything related to Yarn 2 is resolved. The only left are tests. And I think there is a separate problem. I feel like tests can affect each other and they are not isolated. Seems like they may have a shared neutrino config and all Webpack plugins are applied across test. Is it possible? Because currently just commenting one test can make other tests red or green.
@edmorley in Webpack 5 only pnp-webpack-plugin
will be not necessary. All other fixes to ESLint, Jest and etc. will be highly required. Their issues still remain. So with pnp-webpack-plugin
or without it we need this PR any way. But without pnp-webpack-plugin
it will be hard to automate testing in Yarn 2. In my opinion it affects only several presets and it will be really easy to remove it in Neutrino 10 without affecting anything.
@edmorley @eliperelman can you look at final version of this PR?
@constgen Thank you for working on this :-) Before it can be merged (and so before spending time on review), we need to have CI passing, which is blocked on Travis CI credits running out, due to Travis CI's new policy (that is, there are no more free credits). The best way to resolve this would be to migrate to another provider -- I would recommend Circle CI. I don't have time to work on such a migration, but would be happy to review a PR that did so.
Is GitHub Actions is an option? I tried it recently for one of my projects as a replacement for Travis. Have to say that it also has free plan limits but it worked well for me
Yeah that works too :-)
Closing since unfortunately this project is no longer maintained. See: https://github.com/neutrinojs/neutrino/issues/1707 https://github.com/neutrinojs/webpack-chain/issues/358