-
Notifications
You must be signed in to change notification settings - Fork 42
feat: Autosplitting #34
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
Conversation
# Conflicts: # README.md
|
|
||
| // console.log('stats', stats); | ||
|
|
||
| if (externalModules[chunk.id]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theKashey pretty much this loop. Itll tell you about the dependencies on each module.
const module of dependencyModuleSet.chunksIterable lets you loop over the modules in the dependency set. I use (or will be) to get module.chunks.foreach((chunk)=>chunk.files)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's probably a lower level hook you would tap, but inside those chunks are the orderings they need to be loaded in. If a dependency matrix was created, you be able to look up any order
| // const module of chunk.modulesIterable | ||
| chunk.forEachModule((module) => { | ||
| if (module.dependencies) { | ||
| module.dependencies.forEach((dependency) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhink Looping dependencies per module
| const options = compiler?.options; | ||
| const chunkSplitting = options?.optimization?.splitChunks?.cacheGroups || {}; | ||
| chunkSplitting.interleave = { | ||
| test(module) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theKashey this was pretty neat. test provides the whole module, so im able to actually look up the module source and see if its an externalized chunk before placing it into a cacheGroup, i then can give the files a name. This allows me to code split anything by just moving them into another cache group using splitChunks and testing that the module meets the requirement... Automated code-splitting regardless of sync or async. Need to see how it holds up against tree shaking
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉🎉🎉🎉 |
|
@theKashey i discovered some new things that I’ll put up for PR soon. You’ll like |
Use and polyfill native import()
Removed Babel plugin dependence.
fix #4 and #21