Code splitting single JS files based on which functions are used by which parent components or files. #18006
Unanswered
jchabotamica
asked this question in
Q&A
Replies: 1 comment 5 replies
-
Sorry it is not possible, anyway you can create a custom plugin to implement this, or just place require function/classes in each file and split them based on modules |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been looking into ways to deeper code split my js files. We are up to date with the latest versions of webpack, babel, etc.
We already do code splitting, but it seems to just do it on a file by file basis. What I'd like to see is for it to further code split by which functions are used (not like pure tree shaking though because we have that too 😄 ).
As a visual:
src/index.ts
-- references function 1 from file A
--lazy load component A
-- references function 2 from file A
I'm looking for this to split file A so that function 1 gets bundled with the main bundle, and function 2 gets bundles with the separate chunk which includes component A.
Also not, these are you using import/export syntax:
Beta Was this translation helpful? Give feedback.
All reactions