Skip to content

[Bug]: Generated styles.css is not imported in root index.js in bundled mode #1448

@davidferguson

Description

@davidferguson

Version

System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 193.63 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 143.0.7499.194
    Firefox: 145.0.2
    Safari: 18.1.1
  npmPackages:
    @rslib/core: ^0.19.3 => 0.19.3

Details

When in bundled mode, rslib generates a index.js file, as well as a index.css file that contains all the CSS styles of the package. However, this index.css file is not imported in the index.js file, meaning that the styles are not displayed when the component is used.

My expectation is that the bundled output should have an import of the styles.

Reproduce link

https://github.com/davidferguson/rslib-bundle-no-styles-demo

Reproduce Steps

  1. Install the dependencies:

    npm install
  2. Run build:

    npm run build
  3. Inspect the dist/index.js file.

    Observe that there is no import of the dist/index.css file there. There is the import in the dist/Button.d.ts however this is the typing file, not the js code file, so this will not work when used outside a typescript environment.

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