Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Support Webpack 4.x #51

Merged
merged 8 commits into from
Apr 16, 2018
Merged

Support Webpack 4.x #51

merged 8 commits into from
Apr 16, 2018

Conversation

walkerburgin
Copy link
Contributor

Looks like PR #46 is pretty stale. I took a quick crack at updating to support webpack 4.x by going through the schema diff outlined in issue #45.

I'm currently trying to use webpack-chain in a project, but not having support for webpack 4 is a pretty big blocker.

Copy link
Member

@edmorley edmorley left a comment

Choose a reason for hiding this comment

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

This is fantastic - I was just about to take a look at this, so you've saved me having to do it - thank you :-)

There are a couple of small comments, but otherwise looks great.

package.json Outdated
@@ -25,6 +25,6 @@
"devDependencies": {
"ava": "^0.22.0",
"changelog": "^1.4.0",
"webpack": "^3.6.0"
"webpack": "^4.5.0"
Copy link
Member

Choose a reason for hiding this comment

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

Could you update README.md to say now supports webpack 2-4 instead of 2-3?

test/Config.js Outdated
@@ -1,6 +1,6 @@
import test from 'ava';
import Config from '../src/Config';
import { validate } from 'webpack';
import { validateSchema } from 'webpack';
Copy link
Member

Choose a reason for hiding this comment

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

I know #46 made this change, however I don't think it's correct. From what I can tell at first glance (and there aren't really any API docs), validateSchema expects both schema and options, so if called directly without a schema, it's not validating anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like you're right!

@@ -0,0 +1,27 @@
const ChainedMap = require('./ChainedMap');

module.exports = class extends ChainedMap {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a new test test/Optimization.js for this?

@@ -347,6 +347,7 @@ config
.context(context)
.externals(externals)
.loader(loader)
.mode(mode)
Copy link
Member

Choose a reason for hiding this comment

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

The config merging section of the README also references the top level options, could you add mode there too? (I see parallelism is also missing from that, perhaps worth fixing whilst we're there)

Also, could you add the optimization options to the README too? :-)

@edmorley
Copy link
Member

Could you also rebase on master and resolve the conflict? I'd just delete yarn.lock and recreate to pick up the latest changes.

Copy link
Member

@eliperelman eliperelman left a comment

Choose a reason for hiding this comment

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

This is such a great patch, thank you! I have a couple very minor stylistic requests, then I think we can merge!

I'm happy to see this doesn't appear to be a breaking change.

src/Output.js Outdated
@@ -7,11 +7,14 @@ module.exports = class extends ChainedMap {
'auxiliaryComment',
'chunkFilename',
'chunkLoadTimeout',
'chunkCallbackName',
Copy link
Member

Choose a reason for hiding this comment

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

This is super nitpicky, but could you move this to be before chunkFilename so it stays in alphabetical order?

Copy link
Member

Choose a reason for hiding this comment

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

There's a bit of a mix throughout webpack-chain at the moment of alphabetical order vs schema order - would be good to sort it all out at some point :-)

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I thought I already cleaned all those up... 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I did a very quick run through to get all of the extend() calls at least to specify in alphabetical order.

+1 to setting up linting and/or Prettier 😄

test/Config.js Outdated
@@ -85,14 +85,24 @@ test('toConfig with values', t => {
.output
.path('build')
.end()
.mode("development")
Copy link
Member

Choose a reason for hiding this comment

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

Can you replace all the double quotes in here with single quotes to match the style? I need to go in and add better linting tools some day. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, no problem

@edmorley
Copy link
Member

Travis is failing on the node 6 job with:
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6.11.5".

Turns out webpack 4 has bumped the minimum node version:
https://github.com/webpack/webpack/blob/v4.5.0/package.json#L72

...could you increase the version specified in .travis.yml to match? (I guess we could always just use 6 there instead to always use the latest - but I presume the intention was to check backwards compatibility?)

Copy link
Member

@edmorley edmorley left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@eliperelman eliperelman left a comment

Choose a reason for hiding this comment

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

So good!

@eliperelman eliperelman merged commit e4aae70 into neutrinojs:master Apr 16, 2018
@walkerburgin
Copy link
Contributor Author

Thanks @edmorley & @eliperelman for reviewing so quickly!

@eliperelman
Copy link
Member

Our pleasure! Released in v4.6.0.

This was referenced Apr 16, 2018
edmorley added a commit to neutrinojs/neutrino that referenced this pull request Apr 20, 2018
Adds the `mode` and `optimizations` documentation from:
neutrinojs/webpack-chain#51
edmorley added a commit to neutrinojs/neutrino that referenced this pull request Apr 20, 2018
Adds the `mode` and `optimizations` documentation from:
neutrinojs/webpack-chain#51
edmorley added a commit to neutrinojs/neutrino that referenced this pull request Apr 20, 2018
Adds the `mode` and `optimizations` documentation from:
neutrinojs/webpack-chain#51
edmorley added a commit to neutrinojs/neutrino that referenced this pull request Apr 24, 2018
Adds the `mode` and `optimizations` documentation from:
neutrinojs/webpack-chain#51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants