Skip to content

[Bug]: Missing type declaration for CSS imports that are not CSS Modules #5380

@aweebit

Description

@aweebit

Version

npmPackages:
    @rsbuild/core: ^1.3.22 => 1.3.22

Details

For imports like import './App.css', TypeScript reports this error when noUncheckedSideEffectImports is set to true in tsconfig:

Cannot find module './App.css' or its corresponding type declarations.

The reason is that a module declaration for CSS imports other than those of CSS Modules (*.module.css) is missing from @rsbuild/core/types.

Moreover, I noticed that the env.d.ts file referencing the types is not provided in some of the create-rsbuild templates, for example it's not there in the Vanilla + TS template.

Reproduce link

https://github.com/web-infra-dev/rsbuild/tree/main/packages/create-rsbuild/template-react-ts

Reproduce Steps

  1. Add "noUncheckedSideEffectImports": true to tsconfig
  2. Run npm i && npx tsc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions