Parcel tries to import source
of dependency instead of main
or module
even if it does not exist
#7610
Labels
source
of dependency instead of main
or module
even if it does not exist
#7610
🐛 bug report
Parcel tries to resolve the
source
file of dependencies instead of the file specified bymain
ormodule
even if the file referred to bysource
does not exist. This results in errors when importing a package that does not ship with source files.🎛 Configuration (.babelrc, package.json, cli command)
Default configuration. Running
parcel serve
.🤔 Expected Behavior
Parcel should import the file specified by
main
ormodule
if thesource
file is not found.😯 Current Behavior
Parcel always tries to resolve the
source
file of dependencies if it's specified. This fails when importing a package that does not ship with source files.💁 Possible Solution
Use the
main
ormodule
field during import resolution when appropriate.It should be enough to filter entry points for existence in the
NodeResolver
:It's used by the
DefaultResolver
like so:(If this is the correct approach I can submit the change in a PR. I was not able to test this yet.)
🔦 Context
I am trying to import
@radix-ui/react-scroll-area
. This causes the build to fail:💻 Code Sample
🌍 Your Environment
2.2.1
17.4.0
pnpm 6.28.0
Windows 10 21H2
The text was updated successfully, but these errors were encountered: