diff --git a/docs/config/README.md b/docs/config/README.md index 1479c86236..5c4c6e38ca 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -65,7 +65,7 @@ Deprecated since Vue CLI 3.3, please use [`publicPath`](#publicPath) instead. - Type: `string` - Default: `'dist'` - The directory where the production build files will be generated in when running `vue-cli-service build`. Note the target directory will be removed before building (this behavior can be disabled by passing `--no-clean` when building). + The directory where the production build files will be generated in when running `vue-cli-service build`. Note the target directory contents will be removed before building (this behavior can be disabled by passing `--no-clean` when building). ::: tip Always use `outputDir` instead of modifying webpack `output.path`. diff --git a/docs/guide/cli-service.md b/docs/guide/cli-service.md index 81dce4e23a..a5e3a90111 100644 --- a/docs/guide/cli-service.md +++ b/docs/guide/cli-service.md @@ -81,7 +81,7 @@ Options: --inline-vue include the Vue module in the final bundle of library or web component target --name name for lib or web-component mode (default: "name" in package.json or entry filename) --filename file name for output, only usable for 'lib' target (default: value of --name), - --no-clean do not remove the dist directory before building the project + --no-clean do not remove the dist directory contents before building the project --report generate report.html to help analyze bundle content --report-json generate report.json to help analyze bundle content --skip-plugins comma-separated list of plugin names to skip for this run diff --git a/docs/zh/config/README.md b/docs/zh/config/README.md index 0a413a2881..752d3e5015 100644 --- a/docs/zh/config/README.md +++ b/docs/zh/config/README.md @@ -65,7 +65,7 @@ module.exports = { - Type: `string` - Default: `'dist'` - 当运行 `vue-cli-service build` 时生成的生产环境构建文件的目录。注意目标目录在构建之前会被清除 (构建时传入 `--no-clean` 可关闭该行为)。 + 当运行 `vue-cli-service build` 时生成的生产环境构建文件的目录。注意目标目录的内容在构建之前会被清除 (构建时传入 `--no-clean` 可关闭该行为)。 ::: tip 提示 请始终使用 `outputDir` 而不要修改 webpack 的 `output.path`。 diff --git a/docs/zh/guide/cli-service.md b/docs/zh/guide/cli-service.md index d1714578a8..f0e594ebfc 100644 --- a/docs/zh/guide/cli-service.md +++ b/docs/zh/guide/cli-service.md @@ -70,7 +70,7 @@ npx vue-cli-service serve --modern 面向现代浏览器带自动回退地构建应用 --target app | lib | wc | wc-async (默认值:app) --name 库或 Web Components 模式下的名字 (默认值:package.json 中的 "name" 字段或入口文件名) - --no-clean 在构建项目之前不清除目标目录 + --no-clean 在构建项目之前不清除目标目录的内容 --report 生成 report.html 以帮助分析包内容 --report-json 生成 report.json 以帮助分析包内容 --watch 监听文件变化 diff --git a/packages/@vue/cli-service/lib/commands/build/index.js b/packages/@vue/cli-service/lib/commands/build/index.js index 7354731ec5..d749e7230d 100644 --- a/packages/@vue/cli-service/lib/commands/build/index.js +++ b/packages/@vue/cli-service/lib/commands/build/index.js @@ -33,7 +33,7 @@ module.exports = (api, options) => { '--formats': `list of output formats for library builds (default: ${defaults.formats})`, '--name': `name for lib or web-component mode (default: "name" in package.json or entry filename)`, '--filename': `file name for output, only usable for 'lib' target (default: value of --name)`, - '--no-clean': `do not remove the dist directory before building the project`, + '--no-clean': `do not remove the dist directory contents before building the project`, '--report': `generate report.html to help analyze bundle content`, '--report-json': 'generate report.json to help analyze bundle content', '--skip-plugins': `comma-separated list of plugin names to skip for this run`, @@ -193,7 +193,7 @@ async function build (args, api, options) { } if (args.clean) { - await fs.remove(targetDir) + await fs.emptyDir(targetDir) } return new Promise((resolve, reject) => {