这是indexloc提供的服务,不要输入任何密码
Skip to content

DataCloneError on outExtension when DTS is on #667

@zvictor

Description

@zvictor

While using the config file shown below, I get a DataCloneError whenever I turn dts on.

import { defineConfig } from 'tsup'

export default defineConfig({
  format: ['esm', 'cjs'],
  // dts: true,
  outExtension: ({ format }) => ({
    js: `.${format === 'esm' ? 'mjs' : format}`,
  }),
})

Error when dts is on:

DataCloneError: ({ format }) => ({
    js: `.${format === "esm" ? "mjs" : format}`
  }) could not be cloned.
    at new DOMException (node:internal/per_context/domexception:53:5)
    at Worker.postMessage (node:internal/worker:342:5)
    at ~/faugra/node_modules/.pnpm/tsup@6.1.2_typescript@4.7.4/node_modules/tsup/dist/index.js:2060:18
    at new Promise (<anonymous>)
    at dtsTask (~/faugra/node_modules/.pnpm/tsup@6.1.2_typescript@4.7.4/node_modules/tsup/dist/index.js:2058:15)
    at ~/faugra/node_modules/.pnpm/tsup@6.1.2_typescript@4.7.4/node_modules/tsup/dist/index.js:2171:24
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async build (~/faugra/node_modules/.pnpm/tsup@6.1.2_typescript@4.7.4/node_modules/tsup/dist/index.js:2046:3)
    at async CAC.<anonymous> (~/faugra/node_modules/.pnpm/tsup@6.1.2_typescript@4.7.4/node_modules/tsup/dist/chunk-HL6TILEC.js:185:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions