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

web:rollup updates main and module in package.json regardless of current data or the format option #9817

Closed
knitkode opened this issue Apr 13, 2022 · 3 comments
Labels
outdated scope: react Issues related to React support for Nx stale type: bug

Comments

@knitkode
Copy link

Current Behavior

When using web:rollup executor and pass "format": ["cjs"], or whatever combination of formats, the package.json of the built library gets always the "main" and "module" updated as such:

  "main": "index.umd.js",
  "module": "index.esm.js",

Likewise if I have specified in my libs/{myLib}/package.json a value for main and module those value get overwritten by the executor.

Expected Behavior

I would expect that if I specify a different format option to the executor other than the default ["esm", "umd"] that would attempt to update only the targeted package.json keys with the correct file names .For instance if I specify "format": ["cjs"] i would expect the executor to only try to update main with index.cjs.js or whatever name outputted by rollup for that format, and leave module as is found in libs/{myLib}/package.json.

Steps to Reproduce

This can be reproduce wherever, it is enough to look at the source code responsible for this package update https://github.com/nrwl/nx/blob/master/packages/web/src/executors/rollup/rollup.impl.ts#L308-L311

Environment

Node : 16.14.0
   OS   : linux x64
   npm  : 8.6.0
   
   nx : 13.10.1
   @nrwl/angular : Not Found
   @nrwl/cypress : 13.10.1
   @nrwl/detox : Not Found
   @nrwl/devkit : 13.10.1
   @nrwl/eslint-plugin-nx : 13.10.1
   @nrwl/express : Not Found
   @nrwl/jest : 13.10.1
   @nrwl/js : 13.10.1
   @nrwl/linter : 13.10.1
   @nrwl/nest : Not Found
   @nrwl/next : 13.10.1
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 13.2.2
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 13.10.1
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 13.10.1
   @nrwl/web : 13.10.1
   @nrwl/workspace : 13.10.1
   typescript : 4.6.3
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:
         @jscutlery/semver: 2.21.6
         ngx-deploy-npm: 3.1.6
@knitkode
Copy link
Author

This relates or almost duplicate #8475

@AgentEnder AgentEnder added the scope: react Issues related to React support for Nx label Apr 13, 2022
@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

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

No branches or pull requests

2 participants