Hi,
I use Lerna in a multi-repo which create symbolic links between local packages. When using esm with it, tests for constructor fails. Whether you run instance instanceof Constructor or instance.constructor === Constructor, both fails.
I don't reproduce the bug when imported file aren't symbolic links.
Here's a repro-repo to demonstrate.
thank you @GMartigny !
just in case, could you also provide the node version you are experiencing this with as well as your operating system?
following your steps with node v10.8.0 on macOS:
To reproduce run :
npx lerna bootstrap
node
require("esm")
import "./index.js"
It should log false two time in the console instead of true.
my output is:
> require("esm")
esm enabled
> import './index.js'
instanceof false
== false
undefined
just reading your repo code ...
It should log false two time in the console instead of true.
I guess you mean the opposite: should log true two times in the console instead of false?
I'm on Ubuntu 14.06 with node 10.6.0
Well, I meant that the script would return false when it should return true.
@jdalton this seems to be a regression.
@GMartigny in the interim you might be able to use esm v3.0.71, your reduced repo seems to work, unless you need other bugfixes from patch 72 and above.
Just for the record, [email protected] don't reproduce the bug as you've already said. However, I now have an exception while using nyc.
I'll wait for a fix then =)
For testing we can avoid pulling in various projects and test the root issues.
In this case symlinks fall into a couple buckets we don't have covered by tests.
/a/path/this-is-a-symlink/the-file-is-not-a-symlink.js)_Update:
v3.0.75 is released :tada:
Since I update to [email protected], another error pops up. This is not reproduce by my example repo tho.
When I run npx nyc ava (but not when I do npx ava) I get a bunch of TypeError: Cannot read property 'f' of undefined. Should I open another issue ?
Should I open another issue ?
might be better for tracking. although without a repro it might be quite difficult to pinpoint the problem.
couple things you could try prior: definitely try the very latest release version first, currently v3.0.79, as there's still quite a bit of things being ironed out with each release. If I hit an exception like you are experiencing, I also usually delete the cache files (in node_modules/.cache, or run npm ci, if you are using npm 6+, which wipes and re-installs node_modules altogether), and see if it goes away (which is not to say that it's not a bug).
Moving needs tests label to #717 and moving forward with that issue while locking this issue.
Most helpful comment
For testing we can avoid pulling in various projects and test the root issues.
In this case symlinks fall into a couple buckets we don't have covered by tests.
_(e.g.
/a/path/this-is-a-symlink/the-file-is-not-a-symlink.js)_Update:
v3.0.75 is released :tada: