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 package issues after (#10349) #10741

Closed
radulle opened this issue Jun 14, 2022 · 4 comments · Fixed by #10742
Closed

Rollup package issues after (#10349) #10741

radulle opened this issue Jun 14, 2022 · 4 comments · Fixed by #10742
Assignees
Labels
outdated scope: nextjs Issues related to NextJS support for Nx scope: react Issues related to React support for Nx type: bug

Comments

@radulle
Copy link
Contributor

radulle commented Jun 14, 2022

Introduced after feat(web): add support for Node ESM when used to package SSR-ready library (#10349)

Current Behavior

New feature causes issues in tolling that does not support type: module and exports. CSS can't be imported via @import in other CSS files and import in JS/TS and missing react/jsx-runtime error is getting thrown. If I remove type: module and exports it does work. CSS import from lib does work if CSS is added to exports but only in JS, not in CSS.

Expected Behavior

  1. It would be good to have a flag that would omit these two properties from package.json.
  2. Exports should contain generated CSS assets.
  3. CSS should be importable via @import in CSS files

Steps to Reproduce

Here is reproduction Gasket (NextJS with React 17) repo https://github.com/radulle/gasket-issue. It's interesting that pure nextjs app does not have react/jsx-runtime issue https://github.com/radulle/nextjs-issue. This is NX repo where lib is generated https://github.com/radulle/nx-issue. I added FIXME comments with some conclusions in both repos that use the lib.

Failure Logs

Environment

NextJS apps provided in 2 repos, one with React 18 and one React 17.

@jaysoo jaysoo added the scope: react Issues related to React support for Nx label Jun 14, 2022
@jaysoo jaysoo self-assigned this Jun 14, 2022
@jaysoo jaysoo added the scope: nextjs Issues related to NextJS support for Nx label Jun 14, 2022
jaysoo added a commit to jaysoo/nx that referenced this issue Jun 14, 2022
…ecutor so it is an opt-in feature

- Also adds skipTypeField option in case that is causing issues for users
- Fixes nrwl#10741
jaysoo added a commit to jaysoo/nx that referenced this issue Jun 15, 2022
…ecutor so it is an opt-in feature

- Also adds skipTypeField option in case that is causing issues for users
- Fixes nrwl#10741
jaysoo added a commit that referenced this issue Jun 15, 2022
…ecutor so it is an opt-in feature (#10742)

- Also adds skipTypeField option in case that is causing issues for users
- Fixes #10741
@jaysoo
Copy link
Member

jaysoo commented Jun 15, 2022

In the next release, Nx will not generated exports field by default, and users need to opt-in via generateExportsField. This patch should fix issues where entry points are broken with exports.

@sellmeadog
Copy link

My team encountered issues because Nx also started adding type: "module" to the output package.json file with this release. This should be more configurable than forcing module or commonjs as in my situation I have to remove the type property entirely.

@evanjmg
Copy link
Contributor

evanjmg commented Jun 29, 2022

How do we remove the exports field on the current version? My build is breaking

@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 Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: nextjs Issues related to NextJS support for Nx scope: react Issues related to React support for Nx type: bug
Projects
None yet
4 participants