Skip to content

External CSS assets not being inlined when imported via ?inline #959

@compass-vin

Description

@compass-vin

Reproduction link or steps

minimal reproduction: https://stackblitz.com/edit/github-2dddpu9g?file=src%2Findex.ts

  • run npm run build
  • examine output asset indist/index.js
  • notice:
    • the contents of style.css are inlined (as expected, this is correct)
    • the contents of jodit/es2021/jodit.css are not inlined (not expected, this is the bug)
    • Image

What is expected?

I would expect when ?inline is added to the import statement the contents of the file are inlined as a string and assigned to the import variable.

What is actually happening?

In tsdown, the import is being processed as a regular js import statement instead of an instruction to inline the css file as a string.

Any additional comments?

I have prepared the exact same case in Vite 8 library mode (same source files, same tsconfig) to show how it functions in comparison.

https://stackblitz.com/edit/vitejs-vite-2v5kn8ki?file=src%2Findex.ts

  • run npm run build
  • examine output asset indist/index.js
  • notice:
    • the contents of style.css are inlined (as expected)
    • the contents of jodit/es2021/jodit.css are also inlined (as expected).
    • Image

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