ion icon indicating copy to clipboard operation
ion copied to clipboard

Update Next example

Open VirtuaBoza opened this issue 1 year ago • 5 comments

Adds the webpack config override to get around an issue when a dependency depends on https://www.npmjs.com/package/process, causing the middleware compilation to load the browser shim.

VirtuaBoza avatar Jun 29 '24 15:06 VirtuaBoza

This is specifically for middleware?

jayair avatar Jul 04 '24 22:07 jayair

This is specifically for middleware?

yes

VirtuaBoza avatar Jul 05 '24 00:07 VirtuaBoza

I see. Can you give some ways I can test this? When does this happen?

jayair avatar Jul 13 '24 00:07 jayair

I see. Can you give some ways I can test this? When does this happen?

Sorry it took so long to get around to this. Here's an example of the issue: https://github.com/VirtuaBoza/sst-process-repro/blob/main/src/middleware.ts#L5-L11

Attempting to access sst Resources in Next middleware will throw "X is not linked" because an NPM package called "process" is installed in node_modules and sst is importing from "process" without specifying "node:process" due to issues with other runtimes. Next's middleware/edge webpack config is picking up the browser implementation from that package.

The NPM package I'm referencing is: https://www.npmjs.com/package/process That package is a dependency of some popular libraries such as Cypress.

VirtuaBoza avatar Jul 22 '24 13:07 VirtuaBoza

Oh I see. Is there a downside to SST using node:process internally instead of process?

jayair avatar Jul 26 '24 23:07 jayair

we are moving sst/ion -> sst/sst and unfortunately this is going to be a messy process because of github's limitations

i'm going to close this PR for now and it can be re-opened in the new sst/sst repo that will be ready in the next few days if still relevant

fwang avatar Oct 16 '24 13:10 fwang