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

rollup error is being swallowed #22896

Closed
1 of 4 tasks
kikonejacob opened this issue Apr 19, 2024 · 3 comments · Fixed by #23141
Closed
1 of 4 tasks

rollup error is being swallowed #22896

kikonejacob opened this issue Apr 19, 2024 · 3 comments · Fixed by #23141
Assignees
Labels
scope: bundlers Issues related to webpack, rollup type: bug

Comments

@kikonejacob
Copy link

kikonejacob commented Apr 19, 2024

Current Behavior

When a rollup build error occurs, the error is passed down from rollup to nx rollup but the error is not parsed correctly by nx rollup.
Apparently, the error.message has the message but nx is looking at error.formated

Expected Behavior

The error should display the proper typescript message

GitHub Repo

No response

Steps to Reproduce

  1. write a bad code in typescript
  2. run nx build
  3. the error only output the stack not the actual typescript error

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.12.0
OS     : darwin-arm64
yarn   : 1.22.19

nx                 : 18.3.2
@nx/js             : 18.3.2
@nx/jest           : 18.3.2
@nx/linter         : 18.3.2
@nx/eslint         : 18.3.2
@nx/workspace      : 18.3.2
@nx/cypress        : 18.3.2
@nx/devkit         : 18.3.2
@nx/esbuild        : 18.3.2
@nx/eslint-plugin  : 18.3.2
@nx/node           : 18.3.2
@nx/react          : 18.3.2
@nx/rollup         : 18.3.2
@nx/storybook      : 18.3.2
@nrwl/tao          : 18.3.2
@nx/vite           : 18.3.2
@nx/web            : 18.3.2
@nx/webpack        : 18.3.2
typescript         : 5.4.5
---------------------------------------
Community plugins:
@jscutlery/semver : 5.2.2

Failure Logs

No response

Package Manager Version

yarn 1.22.19

Operating System

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

Additional Information

No response

@kikonejacob
Copy link
Author

kikonejacob commented Apr 19, 2024

I'm getting the error even with a freshly bootstrapped nx react library project

 at error (/dev/projects/mynxtest/node_modules/rollup/dist/shared/rollup.js:198:30)
          at throwPluginError (/dev/projects/mynxtest/node_modules/rollup/dist/shared/rollup.js:21718:12)
          at Object.error (/dev/projects/mynxtest/node_modules/rollup/dist/shared/rollup.js:22672:20)
          at RollupContext.error (/dev/projects/mynxtest/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:1457:26)
          at /dev/projects/mynxtest/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:27639:26
          at Array.forEach (<anonymous>)
          at printDiagnostics (/dev/projects/mynxtest/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:27615:17)
          at typecheckFile (/dev/projects/mynxtest/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:27972:9)
          at Object.<anonymous> (/dev/projects/mynxtest/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:28118:21)
          at Generator.next (<anonymous>)
          at /dev/projects/mynxtest/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:63:69
          at new Promise (<anonymous>)
          at __awaiter (/dev/projects/mynxtest/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:59:10)
          at Object.transform (/dev/projects/mynxtest/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:28099:20)
          at /dev/projects/mynxtest/node_modules/rollup/dist/shared/rollup.js:22879:40
      Bundle failed: testpack
      ```

@AgentEnder
Copy link
Member

Can you try this with create-nx-workspace@canary? I know this is a bug that we have recently looked at and thought was solved.

@AgentEnder AgentEnder added the scope: bundlers Issues related to webpack, rollup label Apr 29, 2024
@kikonejacob
Copy link
Author

kikonejacob commented Apr 29, 2024

@AgentEnder I get the same type of error with create-nx-workspace@canary
I can confirm that the bug was introduced on 18.2 , 18.1 works as expected.
Steps to reproduce the error with a brand new project:

  • Bootstrap a new react project with mono repository setup
  • Create new buildable react library using @nx/react with rollup as the bundler.
  • add a failing code in the library index file
  • run the build, the output will only have the rollup error stack and no error "message".

Coly010 pushed a commit that referenced this issue May 8, 2024
closed 22896

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
given using @nx/rollup:rollup executor
when an error is thrown
then no message is logged (just stacktrace)

## Expected Behavior
error message to be displayed (as it was till v18.2.0)

## Related Issue(s)

Fixes #22896
FrozenPandaz pushed a commit that referenced this issue May 9, 2024
closed 22896

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
given using @nx/rollup:rollup executor
when an error is thrown
then no message is logged (just stacktrace)

## Expected Behavior
error message to be displayed (as it was till v18.2.0)

## Related Issue(s)

Fixes #22896

(cherry picked from commit ea5c910)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: bundlers Issues related to webpack, rollup type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants