Skip to content

Cleaning output path happens redundantly #116

@vz-tl

Description

@vz-tl

It seems, cleaning the output path is happening twice:

First in create-config.ts , but only if deleteOutputPath is set to true in rspack.config.ts:

if (options.deleteOutputPath) {
    await deleteOutputDir(
      normalizedOptions.root,
      normalizedOptions.outputPath.base
    );
  }

If deleteOutputPath is unset, normalizedOptions.deleteOutputPath still becomes set to true in normalize-options.ts:

 deleteOutputPath: options.deleteOutputPath ?? true,

and as a consequence, the related rspack option output.clean will also become enabled in common-config.ts:

const defaultConfig = {
        ....
        output: {
            ....
            clean: normalizedOptions.deleteOutputPath,
            ....
        }
}

And this will lead to subsequently deleting the output path.

So, if angular-rspack plugin already takes care for deleting the output path, then

  • the related rspack option never should become enabled
  • the angular-rspack plugin logic should only do the cleanup based on normalizedOptions.deleteOutputPath but not based on the original, not normalized options

It would be great, if the rspack option output.clean NEVER would become enabled, because then we can rely on the cleanup being under full control of the angular plugin and done initially right after starting the build but not somewhere later in the process once rspack is going to do it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions