nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.21k stars 2.31k forks source link

NX Overwrites type in package.json with @nx/vite:build executor #27057

Closed simeon-raykov closed 1 month ago

simeon-raykov commented 1 month ago

Current Behavior

Currently, NX overwrites the type in our package.json in the dist folder if we use the @nx/vite:build executor with the generatePackageJson: true option. We want to use type: 'commonjs', but we get type: 'module' instead.

Screenshot 2024-07-23 at 9 55 39

Expected Behavior

@nx/vite:build does not overwrite the type in package.json if it's already set in the library's package.json when used with the generatePackageJson: true option

GitHub Repo

No response

Steps to Reproduce

  1. Create a new library using NX JS.
  2. Use Vite as the bundler.
  3. Add "type": "commonjs" to package.json.
  4. Add "generatePackageJson": true to the @nx/vite:build.options.
  5. Build the library.
  6. The package.json in the dist folder does not have "type": "commonjs".

Nx Report

Node   : 20.11.0
OS     : darwin-arm64
yarn   : 3.6.1

nx (global)        : 19.5.0
nx                 : 19.1.1
@nx/js             : 19.1.1
@nx/jest           : 19.1.1
@nx/linter         : 19.1.1
@nx/eslint         : 19.1.1
@nx/workspace      : 19.1.1
@nx/cypress        : 19.1.1
@nx/devkit         : 19.1.1
@nx/eslint-plugin  : 19.1.1
@nx/next           : 19.1.1
@nx/playwright     : 19.1.1
@nx/plugin         : 19.1.1
@nx/react          : 19.1.1
@nx/storybook      : 19.1.1
@nrwl/tao          : 19.1.1
@nx/vite           : 19.1.1
@nx/web            : 19.1.1
@nx/webpack        : 19.1.1
nx-cloud           : 19.0.0
typescript         : 5.1.6
---------------------------------------
Community plugins:
@jscutlery/semver      : 5.2.2
@nx-tools/nx-container : 6.0.1
---------------------------------------
Local workspace plugins:
         @ps/web-martech-cms-types
         @ps/web-shared-analytics
         @ps/web-shared-api-types
         @ps/web-core-tools
         @ps/web-core-intl

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

github-actions[bot] commented 2 weeks ago

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.