Skip to content

v0.21.0 Breaks Vue + CSS #800

@methompson

Description

@methompson

Reproduction link or steps

Project with issue can be found here:
https://github.com/methompson/tsdown_issue_example

This project did the following:

  1. Per the instructions on the tsdown page , create a Vue + Tsdown project: npm install -D @tsdown/css
  2. All dependencies were installed with npm i
  3. Once all dependencies are added, tsdown was updated to the latest: npm i tsdown@latest
  4. Styles were added to MyButton.vue

Reproduction steps:

  1. Clone project
  2. Run npm ci to install dependencies from package-lock.json
  3. Run npm run build to attempt to build the project

What is expected?

The project to build (v 0.18 builds fine)

What is actually happening?

An error is thrown causing a build failure:

> vue-components-starter@0.0.0 build
> tsdown

ℹ tsdown v0.21.0 powered by rolldown v1.0.0-rc.7
ℹ config file: /Users/work/Desktop/work/tsdown_issue_example/tsdown.config.ts 
ℹ entry: src/index.ts
ℹ tsconfig: tsconfig.json
ℹ Using Vite config: /Users/work/Desktop/work/tsdown_issue_example/vite.config.ts
ℹ Build start

 ERROR  Error: Build failed with 1 error:

[plugin tsdown:builtin-css]
Error: ENOENT: no such file or directory, open '/Users/work/Desktop/work/tsdown_issue_example/src/MyButton.vue?vue&type=style&index=0&lang.css'
    at async open (node:internal/fs/promises:637:25)
    at async readFile (node:internal/fs/promises:1269:14)
    at async LoadPluginContextImpl.handler (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/tsdown/dist/plugin-BQv869Ce.mjs:105:16)
    at async plugin (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/shared/bindingify-input-options-u9u3KSja.mjs:1132:16)
    at async plugin.<computed> (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/shared/bindingify-input-options-u9u3KSja.mjs:1562:12)
    at aggregateBindingErrorsIntoJsError (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/shared/error-FTNambir.mjs:48:18)
    at unwrapBindingResult (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/shared/error-FTNambir.mjs:18:128)
    at #build (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/shared/rolldown-build-DQKLqVyb.mjs:3308:34)
    at async build (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/index.mjs:46:22)
    at async Promise.all (index 0)
    at async buildSingle (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/tsdown/dist/build-TmLngPCw.mjs:735:19)
    at async Promise.all (index 0)
    at async buildWithConfigs (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/tsdown/dist/build-TmLngPCw.mjs:691:18)
    at async CAC.<anonymous> (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/tsdown/dist/run.mjs:25:2)
    at async runCLI (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/tsdown/dist/run.mjs:49:3)

if lang="scss" is added to the style tag, we get a different error:

> vue-components-starter@0.0.0 build
> tsdown

ℹ tsdown v0.21.0 powered by rolldown v1.0.0-rc.7
ℹ config file: /Users/work/Desktop/work/tsdown_issue_example/tsdown.config.ts 
ℹ entry: src/index.ts
ℹ tsconfig: tsconfig.json
ℹ Using Vite config: /Users/work/Desktop/work/tsdown_issue_example/vite.config.ts
ℹ Build start

 ERROR  Error: Build failed with 1 error:

[PARSE_ERROR] Error: Unexpected token
   ╭─[ src/MyButton.vue?vue&type=style&index=0&scoped=960f1381&lang.scss:2:1 ]
   │
 2 │ .color[data-v-960f1381] {
   │ ┬  
   │ ╰── 
───╯

    at aggregateBindingErrorsIntoJsError (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/shared/error-FTNambir.mjs:48:18)
    at unwrapBindingResult (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/shared/error-FTNambir.mjs:18:128)
    at #build (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/shared/rolldown-build-DQKLqVyb.mjs:3308:34)
    at async build (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/rolldown/dist/index.mjs:46:22)
    at async Promise.all (index 0)
    at async buildSingle (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/tsdown/dist/build-TmLngPCw.mjs:735:19)
    at async Promise.all (index 0)
    at async buildWithConfigs (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/tsdown/dist/build-TmLngPCw.mjs:691:18)
    at async CAC.<anonymous> (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/tsdown/dist/run.mjs:25:2)
    at async runCLI (file:///Users/work/Desktop/work/tsdown_issue_example/node_modules/tsdown/dist/run.mjs:49:3)

Any additional comments?

This issue only occurs when styles are added to Vue components.

If the <style></style> tags exist with no styles present or there are no style tags, it builds fine.

If there are any styles included, including those that aren't used, it fails. scoped doesn't appear to change the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcss

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions