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 the node executor with a buildTarget using @nrwl/js:swc and turning off watch mode, the following error is produced:
TypeError: The "id" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:120:11)
at Module.require (node:internal/modules/cjs/loader:998:3)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/foo/node_modules/@nrwl/js/src/executors/node/node-with-require-overrides.js:23:1)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
This works with watch mode on.
Expected Behavior
This error should not show up with watch mode turned off.
Tracing this leads to the compileSwc (without watch mode) function, which does not return an outfile property. My guess is that this was not meant to be executed since it's used for building a library?
Since outfile is not defined, the node executor tries to require(undefined), causing this error.
That said, if using @nrwl/js:tsc this works perfectly fine with watch mode turned off. So in line with that, I believe the swc compilation option should still work for this use case.
Resolution
It can be fixed quite simply by adding the following
Node : 16.14.2
OS : darwin arm64
npm : 8.5.0
nx : 14.8.2
@nrwl/angular : Not Found
@nrwl/cypress : Not Found
@nrwl/detox : Not Found
@nrwl/devkit : 14.8.2
@nrwl/esbuild : Not Found
@nrwl/eslint-plugin-nx : 14.8.2
@nrwl/expo : Not Found
@nrwl/express : Not Found
@nrwl/jest : 14.8.2
@nrwl/js : 14.8.2
@nrwl/linter : 14.8.2
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 14.8.2
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/rollup : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : Not Found
@nrwl/web : Not Found
@nrwl/webpack : 14.8.2
@nrwl/workspace : 14.8.2
typescript : 4.8.4
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins:
The text was updated successfully, but these errors were encountered:
Anything I can do to help get this through the pipeline? I've had to resort to copying the @nrwl/js package as a local executor in my workspace to get this working.
Current Behavior
When using the node executor with a buildTarget using
@nrwl/js:swc
and turning off watch mode, the following error is produced:This works with watch mode on.
Expected Behavior
This error should not show up with watch mode turned off.
Debugging
It appears that the error is coming from here:
nx/packages/js/src/executors/node/node-with-require-overrides.ts
Lines 1 to 6 in d91c7ca
Where
process.env.NX_FILE_TO_RUN
isundefined
.Tracing this leads to the
compileSwc
(without watch mode) function, which does not return anoutfile
property. My guess is that this was not meant to be executed since it's used for building a library?nx/packages/js/src/utils/swc/compile-swc.ts
Line 70 in d91c7ca
Since
outfile
is not defined, the node executor tries torequire(undefined)
, causing this error.That said, if using
@nrwl/js:tsc
this works perfectly fine with watch mode turned off. So in line with that, I believe the swc compilation option should still work for this use case.Resolution
It can be fixed quite simply by adding the following
Steps to Reproduce
See reproducible example in this repository: https://github.com/calvinl/nx-swc-error-example
Failure Logs
See above
Environment
The text was updated successfully, but these errors were encountered: