Skip to content

Generated types are not removed when the .css module no longer exists #40

Open

Description

@KalashnikovTV

Example:

Image

after we delete index.module.css

Image

and when we started rsbuild build - the types remain in the directory

Activity

  1. CoderSerio commented on Oct 30, 2026

    @CoderSerio

    I notice that typed-scss-modules already removes the generated declaration when a source file is deleted in watch mode:

    .on("unlink", (path) => {
      alerts.info(`[REMOVED] ${path}`);
      removeSCSSTypeDefinitionFile(path, options);
    });

    Could we do something similar here, and also clean up leftover declarations when a build starts 🤔?

    For example, with a new clean option:

    plugins: [
      pluginTypedCSSModules({
        clean: true,
      }),
    ]

    This would only remove files generated by this plugin whose source files no longer exist.

    If you think this makes sense, I'd like to implement it.

  2. chenjiahan commented on Oct 30, 2026

    @chenjiahan
    Member

    PR welcome!

  3. CoderSerio commented on Oct 31, 2026

    @CoderSerio

    2. PR welcome!

    😊 ok, I've opened #94 to address this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions