Skip to content

Module build fails when CSS contains a remote @import URL #94

Description

@domutala

Description

Building a Runable module fails when one of its CSS entries contains a remote @import URL.

The @tsdown/css plugin appears to resolve the URL as a path relative to the CSS file instead of preserving it as an external CSS import.

Minimal reproduction

Create a Runable module with a CSS entry:

import { defineModule } from "runable";

export default defineModule({
  css: ["./app/css/main.css"],
});

Add a remote import to app/css/main.css:

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

@import "tailwindcss";

Then run:

pnpm build

Actual behavior

The build fails because the remote URL is interpreted as a local file path:

WARN [@tsdown/css] Failed to resolve import
'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'

Error: ENOENT: no such file or directory, open
'/path/to/project/app/css/https:/fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'

Expected behavior

Remote CSS imports should either:

  1. remain unchanged in the generated CSS, or
  2. be treated as external resources and not passed to the local filesystem resolver.

Environment

  • Runable: 1.1.0
  • @runablejs/cli: 1.1.0
  • @tsdown/css: 0.22.14
  • Node.js: 24.19.0
  • Package manager: pnpm
  • OS: Linux

Workaround

Removing the remote @import allows the module to build successfully.

Using a locally packaged font would also avoid the issue, but remote CSS imports are valid CSS and should not be resolved as relative filesystem paths.

Activity

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

Metadata

Metadata

Assignees

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