Uh oh!
There was an error while loading. Please reload this page.
Plug'n'Play support - #5136
Conversation
Timer
commented
Sep 27, 2018
We probably need the Jest resolver too, right? |
arcanis
commented
Sep 27, 2018
Oh likely, yes - I tested |
arcanis
commented
Sep 27, 2018
Got it working with the plugin, just one interesting problem - Babel transforms the code to use the If Apart from moving |
The full path option sounds great, especially because it's immediately bundled in other parts of the app. |
arcanis
commented
Sep 27, 2018
Pushed a commit that does exactly this (I'll move it in a separate PR later too so it can be merged independently) 👍 I also need to merge yarnpkg/yarn#6444 and yarnpkg/yarn#6443 on Yarn's side. Will then continue investigating to make sure everything's ok. Do you have suggestions to add tests? Can I just add a travis config that uses PnP to make the install? |
Timer
commented
Sep 27, 2018
We need to majorly overhaul our testing, but a travis config that uses PnP would be best for now. |
arcanis
commented
Sep 29, 2018
Here we go! All green 😃 Note that this PR only makes create-native-app compatible with PnP environments, but doesn't expose a way to toggle it on from the command line (apart from using |
gaearon
commented
Sep 29, 2018
@arcanis Could you clarify what happens to ESLint in the meantime? |
gaearon
commented
Sep 29, 2018
You can add a |
| const nodeArgs = fs.existsSync(pnpPath) ? ['--require', pnpPath] : []; | ||
| await executeNodeScript( |
There was a problem hiding this comment.
Does this work on Node LTS version?
There was a problem hiding this comment.
I think so, it doesn't use any recent feature and the Node 8 tests pass.
| ], | ||
| // Plug'n'Play relies on symlink for its virtual paths (ie peer dependencies), which Webpack | ||
| // always resolve to the absolute path on disk by default. | ||
| symlinks: false, |
There was a problem hiding this comment.
If we're not in PnP mode, would that create problems? It seems like potential breaking change, no?
I'm not sure how this impacts behavior but I wouldn't be surprised if it does.
Is this something we want to do anyway?
There was a problem hiding this comment.
If we do this, symlinking src/ to node_modules/@ won't work because we'll treat app code as node_module code (instead of application code).
We could add special behavior to compile code from @ as app code, but I'd want to collect feedback on what people are using symlinks for currently -- I suspect it'll be in line with the behavior we want.
There was a problem hiding this comment.
@Timer where is defined this @ symlink? Shouldn't it be an alias entry in webpack/jest?
There was a problem hiding this comment.
We didn’t add this feature yet. We were hoping we could do it via symlink instead of adding a special alias to every tool. It would be nice to not confuse IDEs, Flow, etc, which symlink could help with.
arcanis
commented
Sep 30, 2018
I added CRA/ESLint compatibility with yarnpkg/yarn#6449. It basically makes
Will check 👍 |
gaearon
commented
Sep 30, 2018
Can you describe effects of this change in detail, unrelated to PnP? I think this will probably break some existing use cases but I’m not sure they’re valid in the first place. I’m also not sure how this relates to Jest behavior (does Jest match behavior with this flag on or off?) Also is this related to #3883? |
gaearon
commented
Sep 30, 2018
How can I test this? |
arcanis
commented
Sep 30, 2018
I found a way to avoid As for testing I didn't test directly on create-react-app, but I got a case where |
gaearon
commented
Sep 30, 2018
Ah that sounds fine, thanks. I meant — how can I test this PR? Do I need to build yarn from master? |
arcanis
commented
Oct 1, 2018
The nightly Yarn should be fine: https://nightly.yarnpkg.com/yarn-1.12.0-20180928.1315.js To enable PnP when creating a new project, you can set the |
gaearon
commented
Oct 1, 2018
Do we know why AppVeyor build is timing out? |
Timer
commented
Oct 1, 2018
Appears to have started with 2a7346e, though it did not add any new tests for AppVeyor -- strictly Travis. Maybe the |
gaearon
commented
Oct 1, 2018
Thanks! |
| collectCoverageFrom: ['src/**/*.{js,jsx}'], | ||
| setupFiles: ['react-app-polyfill/jsdom'], | ||
| resolver: require.resolve('jest-pnp-resolver'), | ||
| setupFiles: [require.resolve('react-app-polyfill/jsdom')], |
There was a problem hiding this comment.
This leaves an absolute path after ejecting.
* Adds the PnP plugin for Webpack to find dependencies when working under PnP * Adds configuration for jest * Adds an e2e test for when using PnP * Avoids cra from crashing at the engine check * Avoids cra from crashing when initializing react-scripts * Makes the ownPath portable * Fixes linting * Bumps to pnp-webpack-plugin@1.1.0, removes symlinks: false * Adds a --use-pnp option * Pin version
Fixes#5117 - there's still at least one issue with ESLint which cannot load its plugins, and as a result crashes (eslint/eslint#10125), but at least it gets to this point 🙂