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

fix(client): enable code-splitting and dynamic imports in esbuild #741

Merged
merged 2 commits into from
Feb 21, 2023

Conversation

danilowoz
Copy link
Member

@danilowoz danilowoz commented Feb 20, 2023

All kudos to @jeetiss

@vercel
Copy link

vercel bot commented Feb 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
sandpack-docs ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 20, 2023 at 4:03PM (UTC)

@danilowoz danilowoz force-pushed the draft/inspiring-tharp branch from d37714f to d39c13e Compare February 20, 2023 16:01
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d39c13e:

Sandbox Source
Sandpack Configuration

@jeetiss
Copy link
Contributor

jeetiss commented Feb 21, 2023

this PR fixes only esm entries so commonjs still can cause bugs and code duplication because @codesandbox/sandpack-client/clients/node and @codesandbox/sandpack-client/clients/runtime is bundled into @codesandbox/sandpack-client

const { loadSandpackClient } = require("@codesandbox/sandpack-client");
const { SandpackRuntime } = require("@codesandbox/sandpack-client/clients/runtime");

(async () => {
  const client = await loadSandpackClient("div > iframe", {});
  console.log(client instanceof SandpackRuntime);
  // ^ will be false for commonjs but should be true
})();

sandbox

@danilowoz
Copy link
Member Author

Well, esbuild says "Splitting currently only works with the "esm" format"
#753

@jeetiss
Copy link
Contributor

jeetiss commented Feb 22, 2023

Yes, this is impossible to fix with esbuild. it is a tool limitation

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

Successfully merging this pull request may close these issues.

2 participants