Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remix 1.16 breaks yarn pnp #6288

Closed
1 task done
alisd23 opened this issue May 3, 2023 · 7 comments · Fixed by #6562
Closed
1 task done

Remix 1.16 breaks yarn pnp #6288

alisd23 opened this issue May 3, 2023 · 7 comments · Fixed by #6562
Labels

Comments

@alisd23
Copy link
Contributor

alisd23 commented May 3, 2023

What version of Remix are you using?

1.16.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

  1. Fetch basic reproduction: https://github.com/alisd23/remix-issues/tree/polyfills-pnp-bug
  2. Install yarn on your machine
  3. Install dependencies with yarn
  4. Try to run remix build or remix dev
  5. See error resolving polyfill packages

Expected Behavior

Build should work as normal (works in remix 1.15.0)

Actual Behavior

Error when resolving a package via esbuild-plugin-polyfill-node

Cannot find package '@jspm/core' imported from XXX/.yarn/virtual/esbuild-plugin-polyfill-node-virtual-2dbb720e8d/0/cache/esbuild-plugin-polyfill-node-npm-0.2.0-2f43568deb-950f77f1ca.zip/node_modules/esbuild-plugin-polyfill-node/dist/index.cjs [plugin node-polyfills]

Some new dependencies were added: esbuild-plugin-polyfill-node and a new dependency of that, import-meta-resolve which seems to be the actual culprit.

Seems like import-meta-resolve just does straight up not work with Yarn PnP, and it doesn't sound like they can easily fix that - see this issue.

@alisd23
Copy link
Contributor Author

alisd23 commented May 4, 2023

I have added a minimal reproduction showing the issue. It's a complete blocker on version 1.16 for anyone using yarn pnp

@pcattori
Copy link
Contributor

pcattori commented May 5, 2023

Related to #6259

@MichaelDeBoey
Copy link
Member

We just published version 1.17.1-pre.0 which includes #6562 (a possible fix). If you'd like to take it for a test run please try it out and let us know what you think!

@alisd23
Copy link
Contributor Author

alisd23 commented Jun 9, 2023

My reproduction isn't working with this yet, but it did change the error, so possibly something different is broken (but I think related).

However I did try force the version of esbuild in some modern-node-polyfills lib to the latest version (0.18.0), and, other than a few warnings, it worked fine. There's 3 different esbuild versions loaded:

  • 0.17.6: remix/dev + @vanilla-extract/integration
  • 0.17.19: vite
  • 0.14.54: modern-node-polyfills (dependency of esbuild-plugins-node-modules-polyfill) - Fixing this version to 0.18.0 was the solution

The new errors are a few that look like the following, issue seems to be with that version of esbuild importing the @jspm/core library:

node-modules-polyfill Error: Build failed with 1 error:
error: Could not resolve "/Users/ali/Dev/remix-issues/.yarn/cache/@jspm-core-npm-2.0.0-beta.24-085ce16810-c3a986d523.zip/node_modules/@jspm/core/nodelibs/browser/util.js"
    at failureErrorWithLog (/Users/ali/Dev/remix-issues/.yarn/unplugged/esbuild-npm-0.14.54-b3dcd8a41e/node_modules/esbuild/lib/main.js:1624:15)
    at /Users/ali/Dev/remix-issues/.yarn/unplugged/esbuild-npm-0.14.54-b3dcd8a41e/node_modules/esbuild/lib/main.js:1266:28
    at runOnEndCallbacks (/Users/ali/Dev/remix-issues/.yarn/unplugged/esbuild-npm-0.14.54-b3dcd8a41e/node_modules/esbuild/lib/main.js:1179:65)
    at buildResponseToResult (/Users/ali/Dev/remix-issues/.yarn/unplugged/esbuild-npm-0.14.54-b3dcd8a41e/node_modules/esbuild/lib/main.js:1264:7)
    at /Users/ali/Dev/remix-issues/.yarn/unplugged/esbuild-npm-0.14.54-b3dcd8a41e/node_modules/esbuild/lib/main.js:1377:14
    at /Users/ali/Dev/remix-issues/.yarn/unplugged/esbuild-npm-0.14.54-b3dcd8a41e/node_modules/esbuild/lib/main.js:678:9
    at handleIncomingPacket (/Users/ali/Dev/remix-issues/.yarn/unplugged/esbuild-npm-0.14.54-b3dcd8a41e/node_modules/esbuild/lib/main.js:775:9)
    at Socket.readFromStdout (/Users/ali/Dev/remix-issues/.yarn/unplugged/esbuild-npm-0.14.54-b3dcd8a41e/node_modules/esbuild/lib/main.js:644:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: null,
      notes: [],
      pluginName: '',
      text: 'Could not resolve "/Users/ali/Dev/remix-issues/.yarn/cache/@jspm-core-npm-2.0.0-beta.24-085ce16810-c3a986d523.zip/node_modules/@jspm/core/nodelibs/browser/util.js"'
    }
  ],
  warnings: []
}

@MichaelDeBoey
Copy link
Member

@alisd23 since imranbarbhuiya/esbuild-plugins-node-modules-polyfill#111 is merged & released, your problem should be fixed as well if you do a clean install
Can you please check if everything is working as expected now?

@alisd23
Copy link
Contributor Author

alisd23 commented Jun 13, 2023

@MichaelDeBoey Nice, that works on my repro branch now - thanks for sorting that fix so fast!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 1.17.1 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@MichaelDeBoey MichaelDeBoey added the pm:yarn3 Bugs related to Yarn 3 label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants