Home > @lynx-js/rspeedy > Output > cleanDistPath

Output.cleanDistPath property

The Output.cleanDistPath option determines whether all files in the output directory (default: dist) are removed before the build starts.

Signature:

cleanDistPath?: boolean | undefined;

Remarks

By default, if the output directory is a subdirectory of the project root path, Rspeedy will automatically clean all files in the build directory.

When output.distPath.root is an external directory or the same as the project root directory, cleanDistPath is not enabled by default to prevent accidental deletion of files from other directories.

Example 1

  • Disable cleaning files:
import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig({
  output: {
    cleanDistPath: false,
  },
})

Example 2

  • Only clean files before the production build:
import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig({
  output: {
    cleanDistPath: process.env.NODE_ENV === 'production',
  },
})
除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。