Gatsby is not code splitting and is instead one single large file #32143
Replies: 2 comments 1 reply
-
@dungle-scrubs it would mean that you have a lot of dependencies inside wrapRootElement, shared on all pages, ... Any chance you can share the repo? |
Beta Was this translation helpful? Give feedback.
-
@wardpeet I was using Then I updated a few outdated dependencies and the problem completely disappeared. So I think what you pointed out was definitely the cause, although I'm not sure why it continued for a while after I changed it. (I would share the repo if I could, but it's private) Appreciate the insight! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm developing two eCommerce projects side-by-side with almost identical setups and one is code-splitting while the other one isn't and I'm hoping someone else has come across this as well. I can't share the repos unfortunately, but I can do my best to describe what's happening.
I'm running Gatsby v3.8.0
Basically when Gatsby builds, no chunked files are created. Instead it's a single file called for every page, which always looks like this:
app-07541bfa59d6b862aa7a.js
and it's huge, around 800k gzipped.The Gatsby docs on code splitting is helping me narrow it down but I'm stuck.
Inside
.cache
,async-requires.js
looks as it should:But after the build in
/public
,chunk-map.json
ends up like thisWhile
webpack.stats.json
looks like thisIn
/public/_headers
, you can see that the chunk bundles are missing, so it seems like webpack thinks everything is shared under the same app bundle.I understand that Gatsby only sees the
componentChunkName
, so it's just going with the badwebpack.stats.json
that webpack is producing. I'm not modifying webpack throughgatsby-node.js
.So I don't know how to start troubleshooting. Anyone else have some insight? Also what other information should I provide that will make this easier?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions