nrwl / nx

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

Vitest: cache.dir still present in generated config #27039

Closed IgorAufricht closed 3 months ago

IgorAufricht commented 3 months ago

Current Behavior

When generating a new library, the deprecated cache.dir is still present in the generated config, even though it should not be there anymore (https://github.com/nrwl/nx/pull/26756).

Expected Behavior

No cache.dir option in generated vite config.

GitHub Repo

No response

Steps to Reproduce

  1. Checkout the example repo (https://github.com/nrwl/nx-examples)

  2. yarn to install dependencies

  3. yarn nx g @nx/react:library --directory libs/test --name test --importPath test

  4. Select "vitest", "none" and "as provided" for the prompts:

    √ What unit test runner should be used? · vitest
    √ Which bundler would you like to use to build the library? Choose 'none' to skip build setup. · none
    √ What should be the project name and where should it be generated? · test @ libs/test
  5. The generated libs/test/vite.config.ts file still contains the deprecated cache.dir option:

    
    import { defineConfig } from 'vite';
    import react from '@vitejs/plugin-react';
    import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

export default defineConfig({ root: __dirname, cacheDir: '../../node_modules/.vite/libs/test',

plugins: [react(), nxViteTsPaths()],

// Uncomment this if you are using workers. // worker: { // plugins: [ nxViteTsPaths() ], // },

test: { watch: false, globals: true, cache: { dir: '../../node_modules/.vitest/libs/test' }, // <- HERE environment: 'jsdom', include: ['src/*/.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], reporters: ['default'], coverage: { reportsDirectory: '../../coverage/libs/test', provider: 'v8' }, }, });


### Nx Report

```shell
Node   : 20.11.0
OS     : win32-x64
yarn   : 4.1.0

nx                 : 19.5.0-beta.5
@nx/js             : 19.5.0-beta.5
@nx/jest           : 19.5.0-beta.5
@nx/linter         : 19.5.0-beta.5
@nx/eslint         : 19.5.0-beta.5
@nx/workspace      : 19.5.0-beta.5
@nx/angular        : 19.5.0-beta.5
@nx/cypress        : 19.5.0-beta.5
@nx/devkit         : 19.5.0-beta.5
@nx/eslint-plugin  : 19.5.0-beta.5
@nx/react          : 19.5.0-beta.5
@nrwl/tao          : 19.5.0-beta.5
@nx/vite           : 19.5.0-beta.5
@nx/web            : 19.5.0-beta.5
@nx/webpack        : 19.5.0-beta.5
typescript         : 5.5.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/cypress/plugin
@nx/jest/plugin
@nx/vite/plugin
---------------------------------------
Community plugins:
@ngrx/component-store : 18.0.1
@ngrx/effects         : 18.0.1
@ngrx/entity          : 18.0.1
@ngrx/operators       : 18.0.1
@ngrx/router-store    : 18.0.1
@ngrx/store           : 18.0.1
@ngrx/store-devtools  : 18.0.1

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

github-actions[bot] commented 2 months 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.