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

serverBareModulesPlugin displays incorrect warnings for subpath imports in 1.6.2 #3604

Closed
jacobwgillespie opened this issue Jun 29, 2022 · 4 comments · Fixed by #3656
Closed
Labels
bug Something isn't working

Comments

@jacobwgillespie
Copy link
Contributor

jacobwgillespie commented Jun 29, 2022

What version of Remix are you using?

1.6.2

Steps to Reproduce

The change introduced in #3085, where dependencies are tested with require.resolve, fails for modules that do not export a default main. For instance, my Remix app imports @noble/hashes/blake3 - the serverBareModulesPlugin will attempt to require.resolve('@noble/hashes'), which fails because @noble/hashes does not have a main export (intentionally so).

  1. Attempt to import @noble/hahes/blake3 in a file (or any other module that requires importing from a subpath export and does not have a main export)

Expected Behavior

I would expect that the detection logic is able to determine that @noble/hashes is included in my package.json

Actual Behavior

Currently it assumes that any failure of require.resolve implies that the module is not listed in package.json (source) and displays the following warning:

The path "@noble/hashes/blake3" is imported in app/utils/filename.server.ts but @noble/hashes is not listed in your package.json dependencies. Did you forget to install it?
@garth
Copy link

garth commented Jun 30, 2022

Same issue for @heroicons/react.

The path "@heroicons/react/solid" is imported in src/app/routes/login.tsx but @heroicons/react is not listed in your package.json dependencies. Did you forget to install it?

@machour machour added bug Something isn't working and removed bug:unverified labels Jul 5, 2022
@machour
Copy link
Collaborator

machour commented Jul 5, 2022

Bug confirmed on 1.6.3, with the same message as @garth

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-de9fc05-20220712 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!

@machour
Copy link
Collaborator

machour commented Jul 12, 2022

Tried the nightly, and confirming that this is indeed fixed by #3656, thank you @mcansh !

@machour machour closed this as completed Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants