You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using conditional exports and wildcard in package.json with esmock, I stumbled upon this issue: resolvewithplus.js#L224
sould be slice(0,-asteriskAfter.length); to retrieve the non-suffix part instead of the suffix part.
@AdaptivChris would you show me how to reproduce the issue? An example of what the package.json export should look like and what the javascript import-statement look like would probably be sufficient for reproducting. Thanks for opening the issue.
Now you can import any file in the node_modules/{module}/dist/x.mjs as import X from 'module/x.mjs;.
But if you try to mock it with esmock you will get an error regarding .../dist/js.mjs file not existing.
This is due to './x.mjs' being cut to '.mjs' in the faulty line, and then cut again the next line to 'js', which then replace the asterix, so we get the path .../dist/js.mjs
Strangely enough, using the non conditional export "./*.mjs": "./dist/*.mjs" works.
Activity
iambumblehead commentedon May 27, 2026
@AdaptivChris would you show me how to reproduce the issue? An example of what the package.json export should look like and what the javascript import-statement look like would probably be sufficient for reproducting. Thanks for opening the issue.
AdaptivChris commentedon May 27, 2026
Of course, in a node module, have a package.json like this:
Now you can import any file in the
node_modules/{module}/dist/x.mjsasimport X from 'module/x.mjs;.But if you try to mock it with esmock you will get an error regarding .../dist/js.mjs file not existing.
This is due to
'./x.mjs'being cut to '.mjs' in the faulty line, and then cut again the next line to 'js', which then replace the asterix, so we get the path .../dist/js.mjsStrangely enough, using the non conditional export
"./*.mjs": "./dist/*.mjs"works.iambumblehead commentedon May 27, 2026
I'll try to make a reproduction
AdaptivChris commentedon May 27, 2026
index.mjs:file.mjs:node_modules/x/package.json:node_modules/x/dist/x.mjs:iambumblehead commentedon May 27, 2026
still investigating, but following your instructions here #80
iambumblehead commentedon May 27, 2026
the test seems to reproducing the issue. this one works
this one fails,
iambumblehead commentedon May 28, 2026
changes are published to the latest resolvewithplus and esmock packages
https://www.npmjs.com/package/esmock/v/2.7.6
https://www.npmjs.com/package/resolvewithplus/v/2.1.8
feel free reopen or report any issue
fix(deps): update external fixes (#1641)