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

Vite configurations are missing build.emptyOutDir property resulting in output directory not being cleaned, and warning #23382

Closed
1 of 4 tasks
MilanKovacic opened this issue May 14, 2024 · 0 comments · Fixed by #23466
Assignees
Labels
scope: bundlers Issues related to webpack, rollup type: bug

Comments

@MilanKovacic
Copy link

Current Behavior

When building with scaffolded vite.config files, the following error occurs:

(!) outDir [omitted] is not inside project root and will not be emptied.
Use --emptyOutDir to override.

Expected Behavior

Generated vite.config files contain the emptyOutDir property:

build: {
...
emptyOutDir: true,
},

GitHub Repo

No response

Steps to Reproduce

  1. Generate for example, a new React application (@nx/react) using Vite as bundler
  2. Build the project
  3. Warning is presented, and output directory is not cleaned

Nx Report

Node   : 20.13.0
OS     : darwin-arm64
npm    : 10.5.2

nx (global)        : 18.3.4
nx                 : 18.3.4
@nx/js             : 18.3.4
@nx/jest           : 18.3.4
@nx/linter         : 18.3.4
@nx/eslint         : 18.3.4
@nx/workspace      : 18.3.4
@nx/devkit         : 18.3.4
@nx/eslint-plugin  : 18.3.4
@nx/nest           : 18.3.4
@nx/node           : 18.3.4
@nx/playwright     : 18.3.4
@nx/react          : 18.3.4
@nrwl/tao          : 18.3.4
@nx/vite           : 18.3.4
@nx/web            : 18.3.4
@nx/webpack        : 18.3.4
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/vite/plugin
@nx/eslint/plugin
@nx/playwright/plugin
@nx/webpack/plugin
@nx/jest/plugin

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@FrozenPandaz FrozenPandaz added the scope: bundlers Issues related to webpack, rollup label May 15, 2024
Coly010 added a commit that referenced this issue May 17, 2024
…23466)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->
We do not generate `emptyOutDir` when creating vite config, which throws
a warning and does not delete the output directory when it is outside
the project root.
This is common in integrated workspaces


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
`emptyOutDir` should be added to the config

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #23382
FrozenPandaz pushed a commit that referenced this issue May 21, 2024
…23466)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->
We do not generate `emptyOutDir` when creating vite config, which throws
a warning and does not delete the output directory when it is outside
the project root.
This is common in integrated workspaces

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
`emptyOutDir` should be added to the config

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #23382

(cherry picked from commit 9451046)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: bundlers Issues related to webpack, rollup type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants