Skip to content

CSS code-splitting with "rollup-plugin-styles" is broken by PR #4104 (Rollup v2.50.2) #4130

@AurelienStebe

Description

@AurelienStebe

Expected Behavior

The output of Rollup v2.50.1, which makes CSS code-splitting with static CSS outputs possible.

Actual Behavior

Since Rollup v2.50.2 (still the same in the recent v2.51.0 release), the CSS code-splitting doesn't work. The CSS code is duplicated between outputs and the static assets overwrite each others.

I traced the change to PR #4104 and this new "if" condition in particular :

rollup/src/Module.ts

Lines 368 to 370 in 592b9fe

if (dependency instanceof ExternalModule || dependency.isIncluded()) {
relevantDependencies.add(dependency);
}

The modules are not external, so I think the issue is with isIncluded() and effectively the ast.included and namespace.included booleans are false in my logs.
Unfortunately, this is where my knowledge ends. The question is, should "rollup-plugin-styles" change something or should the lines above be changed ? ... and why (just curious) ?

I am not the maintainer of "rollup-plugin-styles", but I do use it in my frontend framework project (GladeJS).
I know this is on the hackish-side of Rollup usage, but I was about to release my CSS code-splitting feature. 😇

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions