-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
🐛 Importing two different modules results in them exporting identical object #551
Comments
Here is a very minimal reproduction case: https://github.com/yunyu/parcel-duplicate-module-reprod To run, do If you run |
Would someone be able to look into this? I think this could be indicative of a deeper issue. |
I've taken a look at it, can confirm something might be off here, but the code that's being required looks quite identical here, not sure if this is a bug (can't look further into it atm) |
Thanks for verifying. If I do a require() without Parcel, the two modules return different types (Inferno returns an Object while Component returns a function): const Inferno = require('inferno');
const Component = require('inferno-component');
// Should print false
console.log(Inferno === Component);
// Should print object
console.log(typeof Inferno);
// Should print function
console.log(typeof Component); Inferno is supposed to be an object, which is correct. Source file: Component is supposed to be a subclassable function. Source file: https://github.com/infernojs/inferno/blob/v3.5.4/packages/inferno-component/src/index.ts#L196 Output on my machine: Could it be an issue with different types of exports breaking the cache? |
Not an issue in Parcel 2 |
🎛 Configuration (.babelrc, package.json, cli command)
.babelrc:
🤔 Expected Behavior
If I do the following:
I expect it to log
false
in the console.😯 Current Behavior
Instead, it logs
true
. The same occurs if I reverse the ordering of the imports, and Component still doesn't export correctly (instead it exports what Inferno should export) even if I remove theinferno
import. This does not happen with Rollup.💁 Possible Solution
Not sure ;(
🔦 Context
I am trying to import
inferno
andinferno-component
so I can use class components with my Inferno application. Unfortunately, they return the exact same object. I suspect this may be an issue with any two modules in which the name of one starts with the name of the other.💻 Code Sample
https://github.com/vanderbilt-design-studio/site-overrides/blob/fecc54137c4e83f29ef2ab2cdb09b519e16de379/overrides.jsx
https://github.com/yunyu/parcel-duplicate-module-reprod
🌍 Your Environment
The text was updated successfully, but these errors were encountered: