Skip to content

Invalid path handling with CSS, when unbundle is true on Windows #319

@stevebeauge

Description

@stevebeauge

Reproduction link or steps

Repro : https://github.com/stevebeauge/tsdown-css-windows-repro

pnpm build => OK
pnpm build --unbundle => KO

Same with setting unbundle through the config file

What is expected?

When using unbundle parameter, and CSS files, the emitted CSS files should be inside dist folder.

  • src/MyComponent.module.css should output dist\MyComponent.module-BlAtsAg0.css (or whatever hash)

What is actually happening?

Using Windows, the output path is src\MyComponent.module-BlAtsAg0.css (inside the src folder).

Full console output:

 tsdown "--unbundle"

ℹ tsdown v0.12.7 powered by rolldown v1.0.0-beta.11-commit.f051675
ℹ Using tsdown config: C:\path\tsdown-css-windows-repro\tsdown.config.ts
ℹ entry: src\index.ts
ℹ tsconfig: tsconfig.json
ℹ Build start
ℹ Cleaning 7 files
ℹ dist/index.js                                                                        0.07 kB │ gzip: 0.07 kB
ℹ dist/MyComponent.js.map                                                              0.40 kB │ gzip: 0.28 kB
ℹ dist/MyComponent.js                                                                  0.37 kB │ gzip: 0.24 kB
ℹ dist/C:\path\tsdown-css-windows-repro\src\MyComponent.module-BlAtsAg0.css.map        0.26 kB │ gzip: 0.18 kB
ℹ dist/MyComponent.module.js                                                           0.18 kB │ gzip: 0.14 kB
ℹ dist/MyComponent.d.ts.map                                                            0.17 kB │ gzip: 0.14 kB
ℹ dist/MyComponent.module.js.map                                                       0.15 kB │ gzip: 0.13 kB
ℹ dist/C:\path\tsdown-css-windows-repro\src\MyComponent.module-BlAtsAg0.css            0.15 kB │ gzip: 0.14 kB
ℹ dist/index.d.ts                                                                      0.07 kB │ gzip: 0.06 kB
ℹ dist/MyComponent.d.ts                                                                0.15 kB │ gzip: 0.13 kB
ℹ 10 files, total: 1.96 kB
✔ Build complete in 163ms

Seems there's something missing in path normalisation

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions