Skip to content

feat(rollup): use .cjs file extension for config files#29196

Merged
jaysoo merged 4 commits intomasterfrom
feat/rollup-config-cjs
Dec 4, 2024
Merged

feat(rollup): use .cjs file extension for config files#29196
jaysoo merged 4 commits intomasterfrom
feat/rollup-config-cjs

Conversation

@jaysoo
Copy link
Copy Markdown
Member

@jaysoo jaysoo commented Dec 4, 2024

The rollup.config.js file will be resolved as ESM if the closest package.json has type: 'module. This causes an error when computing the project graph and when reading the file for builds.

  Original error: require is not defined in ES module scope, you can use import instead

This PR also updates the output directory to {projectRoot}/dist for the new TS setup.

Current Behavior

nx g @nx/react:lib --bundler=rollup has an error due to Node resolution

Expected Behavior

nx g @nx/react:lib --bundler=rollup works out of the box

Related Issue(s)

Fixes #29193, #29195

@jaysoo jaysoo requested review from a team as code owners December 4, 2024 15:20
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 5:45pm

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Dec 4, 2024

Comment thread packages/react/src/generators/library/lib/add-rollup-build-target.ts Outdated
Comment thread packages/react/src/generators/library/lib/add-rollup-build-target.ts Outdated
@jaysoo jaysoo force-pushed the feat/rollup-config-cjs branch from dbd06ca to ffff293 Compare December 4, 2024 15:56
jaysoo and others added 2 commits December 4, 2024 11:34
…get.ts

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
@jaysoo jaysoo force-pushed the feat/rollup-config-cjs branch from 7e328e5 to 34de59f Compare December 4, 2024 17:09
@jaysoo jaysoo force-pushed the feat/rollup-config-cjs branch from 34de59f to 012371f Compare December 4, 2024 17:42
@jaysoo jaysoo enabled auto-merge (squash) December 4, 2024 17:44
@jaysoo jaysoo merged commit 6c5916a into master Dec 4, 2024
@jaysoo jaysoo deleted the feat/rollup-config-cjs branch December 4, 2024 17:53
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated @nx/react:library Rollup Config Incompatible with package.json type: module in Nx 20.2.0-beta.6

4 participants