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

add per chunk index and index2 #7603

Merged
merged 2 commits into from Jun 27, 2018
Merged

add per chunk index and index2 #7603

merged 2 commits into from Jun 27, 2018

Conversation

sokra
Copy link
Member

@sokra sokra commented Jun 26, 2018

refactor index generation

What kind of change does this PR introduce?
feature, bugfix for MCEP

Did you add tests for your changes?
yes

Does this PR introduce a breaking change?
no

What needs to be documented once your changes are merged?
nothing

refactor index generation
@webpack-bot
Copy link
Contributor

For maintainers only:

  • This need to be documented (issue in webpack/webpack.js.org will be filed when merged)

@alexander-akait
Copy link
Member

@sokra can you provide link on issue?

@sokra
Copy link
Member Author

sokra commented Jun 26, 2018

@sokra
Copy link
Member Author

sokra commented Jun 26, 2018

@sokra
Copy link
Member Author

sokra commented Jun 26, 2018

After this PR MCEP can use the per chunk group index to get the module order:

https://github.com/webpack-contrib/mini-css-extract-plugin/blob/eff04a83ff7cdcbc88b282b42977bea05e782ba0/src/index.js#L383

There could still be cases where order can be done correctly (i. e. when extracting modules into a common chunk). It could make sense to emit a warning in these cases (but that probably annoy users since it doesn't matter in most cases).

@sokra
Copy link
Member Author

sokra commented Jun 26, 2018

cc @bawjensen

@alexander-akait
Copy link
Member

@sokra i.e no additional work in MCEP?

# Conflicts:
#	test/__snapshots__/StatsTestCases.test.js.snap
@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@sokra sokra merged commit 486e760 into master Jun 27, 2018
@montogeek montogeek deleted the feature/chunk-module-index branch June 27, 2018 12:37
@alexander-akait
Copy link
Member

/cc @sokra #7603 (comment)

@kamilbrk
Copy link

kamilbrk commented Jul 4, 2018

Is there any reason why stats object is now different due to this PR? And, what's even more confusing, only when running webpack-serve, but not with standard one time build?

I'm using StatsWriterPlugin to generate a JSON file with entry points:
new StatsWriterPlugin({ fields: ['entrypoints'] })

This is what I get out of stats file with following versions:

  • yarn add -D webpack@4.12.2 & npm run build:dev
  • yarn add -D webpack@4.12.2 & npm run start (with webpack-serve@1.0.3)
  • yarn add -D webpack@4.13.0 & npm run build:dev
{
  "entrypoints": {
    "bundle": {
      "chunks": [
        "vendors~bundle", "bundle"
      ],
      "assets": [
        "chunks/vendors~bundle.js", "bundle.js"
      ],
      "children": {},
      "childAssets": {}
    }
  }
}

And this is what I get now with this PR included, but only with webpack-serve:

  • yarn add -D webpack@4.13.0 & npm run start (with webpack-serve@1.0.3)
{
  "entrypoints": {
    "bundle": {
      "chunks": [
        63, 64, 65, 66, 70,
        "vendors~bundle", "bundle"
      ],
      "assets": [
        "chunks/63.js", "chunks/64.js", "chunks/65.js", "chunks/66.js", "chunks/70.js",
        "chunks/vendors~bundle.js", "bundle.js"
      ],
      "children": {},
      "childAssets": {}
    }
  }
}

Turns out 63, 64, 65, 66 and 70 are parts of `chunks/vendors~bundle.js` chunk. It seems like webpack-serve is splitting that file into further separate chunks, for whatever reason, but only with webpack@4.13.0.

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

Successfully merging this pull request may close these issues.

None yet

4 participants