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

Dependencies with multiple entrypoints causes deployment error when targeting Edge runtime #113

Open
mnemitz opened this issue May 21, 2024 · 2 comments

Comments

@mnemitz
Copy link

mnemitz commented May 21, 2024

Setup

I have a minimal Remix app using Vite: https://github.com/mnemitz/remix-test-app

This app imports a dummy library I've created here: https://github.com/mnemitz/my-test-lib

The library has the two module entrypoints defined in its package.json

  "exports": {
    "./module-a": "./dist/module-a/index.js",
    "./module-b": "./dist/module-b/index.js"
  },

Node deployment works

On the main branch of the test app, the deployment succeeds, and successfully outputs data from both modules: https://remix-test-onfl44vri-matt-nemitzs-projects.vercel.app/

Screenshot 2024-05-21 at 17 18 11

Edge deployment fails

However on the edge branch of the app, I've added the following to routes/_index.tsx:

export const config = { runtime: "edge" };

And the deployment results in an error:

Error: The Edge Function "index" is referencing unsupported modules:
--
17:11:16.015 | - build/server/edge-eyJydW50aW1lIjoiZWRnZSJ9/index.js: my-test-lib/module-a, my-test-lib/module-b

Screenshot 2024-05-21 at 17 21 21

@mnemitz
Copy link
Author

mnemitz commented May 21, 2024

I think this may also be causing the issue described here: #94

@mnemitz
Copy link
Author

mnemitz commented Jun 10, 2024

Workaround for anyone hitting this issue is to set the following environment variable: VERCEL_EDGE_FUNCTIONS_ENHANCED_RESOLVE=1

#94 (comment)

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

No branches or pull requests

1 participant