Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js: silently fails to run a file #17083

Closed
1 of 4 tasks
Maxim-Mazurok opened this issue May 18, 2023 · 2 comments · Fixed by #17622
Closed
1 of 4 tasks

js: silently fails to run a file #17083

Maxim-Mazurok opened this issue May 18, 2023 · 2 comments · Fixed by #17622

Comments

@Maxim-Mazurok
Copy link

Current Behavior

I have this:

  "targets": {
    "build": {
      "executor": "@nx/js:tsc",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/packages/analyze",
        "main": "packages/analyze/src/index.ts",
        "tsConfig": "packages/analyze/tsconfig.lib.json",
        "assets": []
      }
    },
    "run": {
      "executor": "@nx/js:node",
      "options": {
        "buildTarget": "analyze:build",
        "watch": false
      }
    },

When I run nx run analyze:run - it says "> NX Successfully ran target run for project analyze" however the actual file is not being run. I can confirm this by throwing in the file, logging to a file, etc.

I believe it's because in #16924 in node.impl.ts there's no handling of non-zero exit codes in task.childProcess.once('exit', (code) => { handler.

After som debugging, I found out that it is trying to run main.js file - the default one.

Previously before #16924 the file to run was determined by NX_FILE_TO_RUN: event.outfile.

Now I have to add "outputFileName": "src/index.js", to my build target options which isn't very nice.

Expected Behavior

  1. When running js file fails - it shows the error
  2. I don't have to specify outputFileName in build target in order to run it (also main.js doesn't seem like a good default because even if I had main.ts - I'd still have to add src/ prefix)

GitHub Repo

No response

Steps to Reproduce

See above

Nx Report

Node   : 19.8.1
   OS     : win32 x64
   npm    : 9.5.1
   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/eslint-plugin  : 16.2.1
   @nx/plugin         : 16.2.1
   @nrwl/tao          : 16.2.1
   @nx/vite           : 16.2.1
   nx-cloud           : 16.0.5
   typescript         : 5.0.4

Failure Logs

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@Maxim-Mazurok
Copy link
Author

A temporary workaround is to use 16.0.1 where import paths weren't broken yet (#16911)

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants