Skip to content

feature-request: add tsdown shim to bundle whitelist to prevent bundle hint #907

@magicdawn

Description

@magicdawn

Clear and concise description of the problem

with tsdown.config.ts

import { defineConfig } from 'tsdown'

export default defineConfig({
  entry: ['src/cli.ts'],
  format: 'esm',
  target: 'node20',
  clean: true,
  shims: true,
  dts: false,
  fixedExtension: false,
  deps: {
    // skipNodeModulesBundle: true,
    // onlyBundle: false,
  },
})

src/cli.ts

console.log(__filename)

with shims enabled, and esm-shims from tsdown package

//#region node_modules/.pnpm/tsdown@0.21.7_@emnapi+core@1.9.2_@emnapi+runtime@1.9.2_synckit@0.11.12_typescript@6.0.2/node_modules/tsdown/esm-shims.js
const getFilename = () => fileURLToPath(import.meta.url);
const __filename = /* @__PURE__ */ getFilename();
//#endregion

will generate hint

ℹ Hint: consider adding deps.onlyBundle option to avoid unintended bundling of dependencies, or set deps.onlyBundle: false to disable this hint.
See more at https://tsdown.dev/options/dependencies#deps-onlybundle
Detected dependencies in bundle:
- tsdown

Suggested solution

this hint looks like a mistake and confusing users: tsdown bundling tsdown ?

so i suggest: do not print hint for bundle shims

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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