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

Parcel 2.9.x serve bug when using .proxyrc.js file and yarn pnp resolver #9059

Closed
itaylor opened this issue Jun 1, 2023 · 1 comment Β· Fixed by #9069
Closed

Parcel 2.9.x serve bug when using .proxyrc.js file and yarn pnp resolver #9059

itaylor opened this issue Jun 1, 2023 · 1 comment Β· Fixed by #9069

Comments

@itaylor
Copy link

itaylor commented Jun 1, 2023

πŸ› bug report

When using a .proxyrc.js file in a project that uses yarn pnp module resolution, Parcel throws exceptions when starting the dev server with parcel 2.9.

➜  workspace git:(master) βœ— yarn start | cat
TypeError: Cannot read properties of null (reading 'resolveToUnqualified')
    at NodePackageManager.resolveInternal (/project/home/itaylor/workspace/.yarn/__virtual__/@parcel-package-manager-virtual-032b6d7d29/2/.cache/yarn/@parcel-package-manager-npm-2.9.1-c7a23c41b1-849d334663.zip/node_modules/@parcel/package-manager/lib/index.js:3669:49)
    at NodePackageManager.resolve (/project/home/itaylor/workspace/.yarn/__virtual__/@parcel-package-manager-virtual-032b6d7d29/2/.cache/yarn/@parcel-package-manager-npm-2.9.1-c7a23c41b1-849d334663.zip/node_modules/@parcel/package-manager/lib/index.js:3443:33)
    at NodePackageManager.require (/project/home/itaylor/workspace/.yarn/__virtual__/@parcel-package-manager-virtual-032b6d7d29/2/.cache/yarn/@parcel-package-manager-npm-2.9.1-c7a23c41b1-849d334663.zip/node_modules/@parcel/package-manager/lib/index.js:3374:47)
    at $72a0cbc70345a858$export$2e2bcd8739ae039.applyProxyTable (/project/home/itaylor/.cache/yarn/@parcel-reporter-dev-server-npm-2.9.1-83db12068f-9fcbf33992.zip/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:16867:57)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async $72a0cbc70345a858$export$2e2bcd8739ae039.start (/project/home/itaylor/.cache/yarn/@parcel-reporter-dev-server-npm-2.9.1-83db12068f-9fcbf33992.zip/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:16898:9)
    at async Object.report (/project/home/itaylor/.cache/yarn/@parcel-reporter-dev-server-npm-2.9.1-83db12068f-9fcbf33992.zip/node_modules/@parcel/reporter-dev-server/lib/ServerReporter.js:17330:43)
    at async ReporterRunner.report (/project/home/itaylor/.cache/yarn/@parcel-core-npm-2.9.1-f045126896-a63a341127.zip/node_modules/@parcel/core/lib/ReporterRunner.js:98:11)
    at async Parcel.watch (/project/home/itaylor/.cache/yarn/@parcel-core-npm-2.9.1-f045126896-a63a341127.zip/node_modules/@parcel/core/lib/Parcel.js:239:7)
    at async run (/project/home/itaylor/workspace/.yarn/__virtual__/parcel-virtual-a111aa5f57/2/.cache/yarn/parcel-npm-2.9.1-09338b9340-9ad2ffd95a.zip/node_modules/parcel/lib/cli.js:286:9)

This did not occur with parcel 2.8.3.

Here's a link to a codesandbox that repros the issue.
https://codesandbox.io/p/sandbox/youthful-neumann-4biw3m?file=%2F.proxyrc.js%3A6%2C9

Run yarn start | cat in the codesandbox terminal to repro the problem.
remove the .proxyrc.js file, and rerun, and parcel starts fine. Downgrade parcel to 2.8.3 and it also works fine.

πŸ€” Expected Behavior

.proxyrc.js should be supported regardless of package manager.

πŸ’ Possible Solution

I believe that the pnp context is not being set up properly for resolution of the .proxyrc.js (and perhaps also for other js config files). This problem likely came in with the new Resolver in 2.9.

πŸ’» Code Sample

https://codesandbox.io/p/sandbox/youthful-neumann-4biw3m?file=%2F.proxyrc.js%3A6%2C9

🌍 Your Environment

Software Version(s)
Parcel 2.9.1
Node 18.15.0
npm/Yarn Yarn 3.2.3 (with PnP linker)
Operating System Mac
@amartincolby
Copy link

Can confirm behavior. I can also confirm that downgrading to 2.8.3 fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants