Skip to content

Conversation

@ScriptedAlchemy
Copy link
Owner

@ScriptedAlchemy ScriptedAlchemy commented Sep 6, 2019

Use and polyfill native import()
Removed Babel plugin dependence.

fix #4 and #21


// console.log('stats', stats);

if (externalModules[chunk.id]) {
Copy link
Owner Author

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)

Copy link
Owner Author

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) => {
Copy link
Owner Author

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) {
Copy link
Owner Author

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

@ScriptedAlchemy ScriptedAlchemy merged commit d3ae503 into master Sep 11, 2019
@ScriptedAlchemy
Copy link
Owner Author

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@theKashey
Copy link

🎉🎉🎉🎉

@ScriptedAlchemy
Copy link
Owner Author

@theKashey i discovered some new things that I’ll put up for PR soon. You’ll like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async/Await?

3 participants