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

Error in preview when using code splitting #6128

Open
KutnerUri opened this issue Jul 13, 2022 · 0 comments
Open

Error in preview when using code splitting #6128

KutnerUri opened this issue Jul 13, 2022 · 0 comments
Labels

Comments

@KutnerUri
Copy link
Contributor

KutnerUri commented Jul 13, 2022

When using code splitting, webpack creates assets (*.chunk.[hash].js, etc), which are not picked up as component artifacts.
Then when loading the preview, the browser tries to load these chunks and fails with 404.

For example:
https://jw02b1z.scopes.teambit.cloud/api/teambit.react/react/~aspect/env-template/compositions/#teambit.community/apps/[email protected]?preview=compositions&BitDevBasic

by @GiladShoham, this is happening because we take a partial list from the Webpack "stats" output, as seen here:

const info = stats.toJson({

We need to:

  • separate each chunk to output in its own folder (via the output.path option, or the output.filename option with a template string like "[name]/...". Note that we'd might also have to fill the other filename options too)
  • load all files from the folder as artifcats
  • somehow separate them when loading component preview (we only want the entry assets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant