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

injectStyle function with dts: true results in DataCloneError #1194

@arielweinberger

Description

@arielweinberger

When using injectStyle with a function and having dts: true example:

// tsup.config.ts
import { defineConfig, Options } from "tsup-async-inject-style";

export default defineConfig((options: Options) => {
  return {
    entry: ["src/**/*.ts", "src/**/*.tsx"],
    format: ["esm", "cjs"],
    dts: true,
    minify: false,
    external: ["react"],
    splitting: false,
    clean: true,
    sourcemap: true,
    injectStyle: (css) => {
      return `console.log()`
    },
    ...options,
  };
});

I get the following error:

DataCloneError: (css) => {
      return `console.log()`;
    } could not be cloned.
    at new DOMException (node:internal/per_context/domexception:53:5)
    at Worker.postMessage (node:internal/worker:378:5)
    at /Users/arielweinberger/Development/copilotkit/CopilotKit/CopilotKit/node_modules/.pnpm/tsup-async-inject-style@0.0.1_@swc+core@1.5.28_jiti@1.21.6_postcss@8.4.40_typescript@5.5.4_yaml@2.5.0/node_modules/tsup-async-inject-style/dist/index.js:1521:22
    at new Promise (<anonymous>)
    at dtsTask (/Users/arielweinberger/Development/copilotkit/CopilotKit/CopilotKit/node_modules/.pnpm/tsup-async-inject-style@0.0.1_@swc+core@1.5.28_jiti@1.21.6_postcss@8.4.40_typescript@5.5.4_yaml@2.5.0/node_modules/tsup-async-inject-style/dist/index.js:1515:19)
    at /Users/arielweinberger/Development/copilotkit/CopilotKit/CopilotKit/node_modules/.pnpm/tsup-async-inject-style@0.0.1_@swc+core@1.5.28_jiti@1.21.6_postcss@8.4.40_typescript@5.5.4_yaml@2.5.0/node_modules/tsup-async-inject-style/dist/index.js:1700:28
    at async Promise.all (index 0)
    at async build (/Users/arielweinberger/Development/copilotkit/CopilotKit/CopilotKit/node_modules/.pnpm/tsup-async-inject-style@0.0.1_@swc+core@1.5.28_jiti@1.21.6_postcss@8.4.40_typescript@5.5.4_yaml@2.5.0/node_modules/tsup-async-inject-style/dist/index.js:1492:3)
    at async CAC.<anonymous> (/Users/arielweinberger/Development/copilotkit/CopilotKit/CopilotKit/node_modules/.pnpm/tsup-async-inject-style@0.0.1_@swc+core@1.5.28_jiti@1.21.6_postcss@8.4.40_typescript@5.5.4_yaml@2.5.0/node_modules/tsup-async-inject-style/dist/chunk-777RIKDU.js:143:5)
    at async main (/Users/arielweinberger/Development/copilotkit/CopilotKit/CopilotKit/node_modules/.pnpm/tsup-async-inject-style@0.0.1_@swc+core@1.5.28_jiti@1.21.6_postcss@8.4.40_typescript@5.5.4_yaml@2.5.0/node_modules/tsup-async-inject-style/dist/chunk-777RIKDU.js:148:3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions