nx icon indicating copy to clipboard operation
nx copied to clipboard

In node with esbuild and esm, the output results do not include the libs

Open wizardnet972 opened this issue 1 year ago • 7 comments

Current Behavior

I create a nodejs app with esbuild and esm.

In the project, I have imports from libs.

When nx builds the node project it not add the mapping code to the output files (_resolveFilename) or don't add them to package.json.

The results are the libs is missing from the node runtime.

Expected Behavior

like cjs format, should be handle the imports from the libs.

GitHub Repo

No response

Steps to Reproduce

  1. create workspace
  2. create node app with esbuild
  3. change the format to esm

Nx Report

yarn nx report
yarn run v1.22.19
>  NX  Falling back to ts-node for local typescript execution. This may be a little slower.
  - To fix this, ensure @swc-node/register and @swc/core have been installed

 >  NX   Report complete - copy this into the issue template

   Node   : 18.13.0
   OS     : darwin arm64
   yarn   : 1.22.19
   Hasher : Native

   nx                 : 16.2.1
   @nx/js             : 16.2.1
   @nx/jest           : 16.2.1
   @nx/linter         : 16.2.1
   @nx/workspace      : 16.2.1
   @nx/devkit         : 16.2.1
   @nx/esbuild        : 16.2.1
   @nx/eslint-plugin  : 16.2.1
   @nx/node           : 16.2.1
   @nrwl/tao          : 16.2.1
   @nx/vite           : 16.2.1
   typescript         : 5.0.4
   ---------------------------------------
   Community plugins:
   @nx/rspack : 16.1.2

✨  Done in 1.10s.


### Failure Logs

_No response_

### Operating System

- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)

### Additional Information

_No response_

wizardnet972 avatar May 20 '23 13:05 wizardnet972