Skip to content

Unbundle does not emit .css imports #842

@RobinVdBroeck

Description

@RobinVdBroeck

Reproduction link or steps

https://github.com/RobinVdBroeck/tsdown-unbundle-css-bug

What is expected?

When using unbundle: true with css.inject: true, we should get import "stylesheet.css" in dist aswel. However, this is not the case.

CSS modules do not seem to have this problem.

What is actually happening?

In the example, button gets renamed to button2.js in the dist folder, the css import is dropped.

Any additional comments?

css.splitting should default to true if unbundle: true, now defaults to false.

This use case for this is tree shaking, since we would like vite (or another build tool) to be able to drop the css for components that are not imported in the final product.

Metadata

Metadata

Assignees

No one assigned

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions