Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Implement webpack 4 support #57

Merged
merged 11 commits into from
Mar 9, 2018

Conversation

toxic-johann
Copy link
Contributor

A pull request to fix #52

It mainly change this two part.

  • Update compiler/compliation.plugin to the new Tapable api (using hook and hookAsync respectively)
  • Change chunks.parents to use ChunkGroup.getParents()

But this change do not compatible webpack < 4. If we need that, we need two whole different logic, I think it's better to provide two version.

It pass 16/17 of the unit test, one failed is because extract-text-webpack-plugin do not support webpack4 well.

@jfsiii
Copy link

jfsiii commented Mar 4, 2018

@toxic-johann Thanks for submitting this.

I'm not sure which issues you were seeing with extract-text-webpack-plugin, but they recently released a version which fixed two issues related to webpack 4. Take a look at https://github.com/webpack-contrib/extract-text-webpack-plugin/releases/tag/v4.0.0-beta.0 and see if that helps.

@toxic-johann
Copy link
Contributor Author

@jfsiii Thanks for the advice. The problem is fixed in the latest version.

@toxic-johann
Copy link
Contributor Author

@jeffposnick Do you have time to review my pr? Or should i implement this based on v3?

@midudev
Copy link

midudev commented Mar 5, 2018

👏

package.json Outdated
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^1.1.11",
"html-webpack-plugin": "^3.0.4",
"jasmin": "0.0.2",
Copy link

@whazap whazap Mar 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that looks like it got added by mistake? "jasmin" package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's a mistake.

@jeffposnick
Copy link
Contributor

Thanks a ton for working on this, @toxic-johann!

I've also started work on the webpack v4 story, but I'd like to maintain legacy webpack support in the same version.

I've also been refactoring the codebase to break things out into smaller modules.

I'd love to incorporate some of the changes you made in this PR into the v3 codebase—in particular, the changes for doesChunkBelongToHTML was something that I was trying to figure out for myself. But, at the same time, keeping things backwards-compatible with the legacy webpack interface was my goal.

You can see where things stand with, e.g., https://github.com/GoogleChromeLabs/preload-webpack-plugin/blob/v3/src/lib/does-chunk-belong-to-html.js

So... you could either file a PR against the v3 branch with a subset of these changes, or I'm happy to extract the relevant bits around chunk groups and incorporate it as part of the work that I've been doing over the past few days (giving you credit in the code).

@toxic-johann
Copy link
Contributor Author

toxic-johann commented Mar 7, 2018

Thanks, @jeffposnick . Both ways are ok. I will try to file a pr against v3 this weekend, if i have time.

As for the legacy webpack support in master branch, I think I can finished in this pr.

@toxic-johann
Copy link
Contributor Author

@jeffposnick Now the master branch can support both webpack v3 and webpack v4.

@jeffposnick
Copy link
Contributor

Thanks a lot for working through this, @toxic-johann! My current plan is to merge this into master and then integrate the techniques into the current v3 refactoring. I can cut another v2.x minor release in the meantime, for folks who don't want to wait on webpack 4 support.

@toxic-johann
Copy link
Contributor Author

I agree. And I will try to make some help on v3 branch too.

@jeffposnick jeffposnick merged commit 798fc67 into GoogleChromeLabs:master Mar 9, 2018
@jeffposnick
Copy link
Contributor

(FYI, @toxic-johann, I've ported what I think is equivalent logic into the latest commits in the v3 branch. So don't feel obligated to spend time on it at the moment.)

@toxic-johann
Copy link
Contributor Author

That's great!!

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

Successfully merging this pull request may close these issues.

Webpack 4 support
5 participants