Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

injectStyle function with dts: true results in DataCloneError #1194

Closed
arielweinberger opened this issue Sep 6, 2024 · 2 comments · Fixed by #1193
Closed

injectStyle function with dts: true results in DataCloneError #1194

arielweinberger opened this issue Sep 6, 2024 · 2 comments · Fixed by #1193
Labels

Comments

@arielweinberger
Copy link
Contributor

arielweinberger commented Sep 6, 2024

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/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/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/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/tsup-async-inject-style/dist/index.js:1515:19)
    at /Users/arielweinberger/Development/copilotkit/CopilotKit/CopilotKit/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/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/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/tsup-async-inject-style/dist/index.js:1492:3)
    at async CAC.<anonymous> (/Users/arielweinberger/Development/copilotkit/CopilotKit/CopilotKit/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/tsup-async-inject-style/dist/chunk-777RIKDU.js:143:5)
    at async main (/Users/arielweinberger/Development/copilotkit/CopilotKit/CopilotKit/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/tsup-async-inject-style/dist/chunk-777RIKDU.js:148:3)

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@arielweinberger
Copy link
Contributor Author

My PR #1193 fixes this one as well.

Copy link
Contributor

🎉 This issue has been resolved in version 8.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant