Skip to content

Class constructor readonly arguments generate heavily nested runtime files #265

Closed as not planned

Description

@tats-u

Reproduction link or steps

https://github.com/tats-u/tsdown-prop-bug

  1. Clone
  2. pnpm i
  3. node --run build
  4. Check the generated files

What is expected?

Only index.{d.ts,js} exist

build:tsup instead of build can get this result

What is actually happening?

Other extra files exist.

They contain abnormally nested references like:

import { __commonJS } from "../../../../../../../../_virtual/rolldown_runtime.js";

Any additional comments?

tsup don't generate such extra files.

Activity

  1. added theissue type on May 25, 2025
  2. Gugustinette commented on May 26, 2025

    @Gugustinette
    Collaborator

    This is caused by the unbundle mode, turning it off will generate only index.js and index.d.ts as you expect.

  3. sxzz commented on May 27, 2025

    @sxzz
    Member
    • _virtual: Since unbundle mode is enabled, the rolldown runtime will be extracted into a separate file. This is the expected behavior. In contrast, esbuild and tsup duplicate the runtime code in every single file.
    • node_modules: track Partial bundling #262
  4. changed the issue type fromtoon May 27, 2025
  5. tats-u commented on May 27, 2025

    @tats-u
    Author

    JS files in dist\node_modules\.pnpm\@oxc-project_runtime@0.71.0\node_modules\@oxc-project\runtime\src\helpers have following malformed import and require:

    import { __commonJS } from "../../../../../../../../_virtual/rolldown_runtime.js";
  6. changed the title [-]Class constructor readonly arguments generate extra runtime files[/-] [+]Class constructor readonly arguments generate extra invalid runtime files[/+] on May 28, 2025
  7. changed the title [-]Class constructor readonly arguments generate extra invalid runtime files[/-] [+]Class constructor readonly arguments generate heavyly nested runtime files[/+] on May 29, 2025
  8. changed the title [-]Class constructor readonly arguments generate heavyly nested runtime files[/-] [+]Class constructor readonly arguments generate heavily nested runtime files[/+] on May 29, 2025
  9. Gugustinette commented on Aug 4, 2025

    @Gugustinette
    Collaborator

    @tats-u the import you pointed out seems fine to me ?

    I mean it is ugly looking of course, but that's what it should be, it correctly points to the imported file. (Atleast it was the case when I built with the repo you gave)

  10. tats-u commented on Aug 5, 2025

    @tats-u
    Author

    What if you publish files including that funny import statement as an npm package and users install that package in a non-monorepo project and execute that statement? Node will try to read a js file in the _virtual directory in the file system root directory due to so many ../.

  11. Gugustinette commented on Aug 5, 2025

    @Gugustinette
    Collaborator

    @tats-u As far as I tested it works, so you should provide a reproduction that clearly demonstrate this (for example configuring two npm packages locally, using the file:../ protocol).

  12. tats-u commented on Sep 4, 2025

    @tats-u
    Author

    Probably my misunderstanding.

  13. sxzz commented on Oct 28, 2026

    @sxzz
    Member

    Closing since the reporter confirmed the deep _virtual import path works at runtime. Feel free to reopen with a reproduction if it actually breaks consumers.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions