esm not found when using yarn Plug 'N Play

Created on 14 Dec 2018  Â·  3Comments  Â·  Source: standard-things/esm

Went to give Yarn's Plug 'N Play a shot today and one of my npm scripts that uses esm threw an error I couldn't resolve.

~/lab/plug-play-esm via ⬢ v10.13.0
➜ yarn build:esm
yarn run v1.12.3
$ node -r esm test.js
Error: Cannot find module 'esm'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

~/lab/plug-play-esm via ⬢ v10.13.0
➜ yarn build:esm:yarn
yarn run v1.12.3
$ yarn node -r esm test.js
Error: Cannot find module 'esm'
error Command failed.
Exit code: 1
Command: /usr/local/bin/node
Arguments: -r esm test.js
Directory: /Users/gregg/lab/plug-play-esm
Output:

info Visit https://yarnpkg.com/en/docs/cli/node for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

basic repro case: https://github.com/greggb/plug-play-esm

Is this an interaction with yarn pnp's resolve wrapper interfering with esm? Or is it just my own misunderstanding of how I should be using esm?

bug

Most helpful comment

On revisiting this issue, it does appear to be an esm bug. Patched https://github.com/standard-things/esm/commit/30a1be28084c8d04f50b69b31dfbeb568d59e7e0.

All 3 comments

Hi @greggb!

It looks like a bug/regression with yarn node.
If you do the long form node -r ./.pnp.js -r esm ./test.js it works. Would you be up for filing a bug on yarn?

Sure thing. Thanks for the fast reply, as always.

On revisiting this issue, it does appear to be an esm bug. Patched https://github.com/standard-things/esm/commit/30a1be28084c8d04f50b69b31dfbeb568d59e7e0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bensampaio picture bensampaio  Â·  3Comments

clock157 picture clock157  Â·  3Comments

tunnckoCore picture tunnckoCore  Â·  3Comments

deepsweet picture deepsweet  Â·  3Comments

dnalborczyk picture dnalborczyk  Â·  3Comments