codesandbox / codesandbox-client

An online IDE for rapid web development
https://codesandbox.io
Other
13.03k stars 2.27k forks source link

"Could not find module in path" error with specific dependency #5853

Closed panick-carousel closed 3 years ago

panick-carousel commented 3 years ago

🐛 bug report

Preflight Checklist

Description of the problem

The assert module fails to resolve for version 2.0.0 but works fine for 1.5.0.

What appears to be happening is that the package.json for 1.5.0 is being used to look for the module entry point in 2.0.0. The difference between the two versions of assert is that the path to "main" in package json changed. I think somehow the 1.5.0 value is cached and reused in 2.0.0, which causes the error.

How has this issue affected you? What are you trying to accomplish?

This is basic functionality that I would expect to work without error

To Reproduce

Starting with a blank react sandbox, add a dependency on "assert" and set it to version 2.0.0, which is the latest. Import it in App.js and observe failure to compile. Then change the version of "assert" to 1.5.0 and observe the code working fine.

Link to sandbox: [link]() (optional)

https://codesandbox.io/s/lucid-gates-0xgy3?file=/src/App.js

Your Environment

Software Name/Version
Сodesandbox latest ?
Browser Chrome latest
Operating System win10 latest
lbogdan commented 3 years ago

Hey @panick-carousel ,

Thanks for your report!

I can reproduce this, we'll take a look at this and get back to you.

bietkul commented 3 years ago

@lbogdan I'm facing the similar kind of issue. Please check this codesanbox link. https://codesandbox.io/s/github/appbaseio/reactivesearch/tree/vue-maps/packages/vue/examples/reactive-google-map?file=/src/main.js The example works fine locally. It was working with codesandbox two days back.

bietkul commented 3 years ago

If I define the template property as node in sandbox.config.json then it works well. But I want to make it work with vue-cli template to avoid the eslint errors.

{
    "template": "node"
}
DeMoorJasper commented 3 years ago

Cannot reproduce this, does it still happen?

bietkul commented 3 years ago

It is strange. It doesn't happen now.

DeMoorJasper commented 3 years ago

The bundler changed a lot since this issue so it's probbaly fixed.

Gonna close this issue for now, feel free to reopen or open q new issue if it persists