Skip to content

Commit

Permalink
webpack v5 compatibility (#2641)
Browse files Browse the repository at this point in the history
* WIP webpack v5 migration

* Linting

* WIP again

* Linting

* Remove all: false

* webpack dep bump

* InjectManifest remediation

* Linting.

* Require 4.40

* Still WIP

* WIP

* Redo the asset/chunk mapping

* Fixed some test cases

* Another test fix

* Get assets from child compilations

* Tests pass

* Re-arranged some thing.

* Re-arranging things

* Good webpack v4/v5 testing setup

* Review feedback
  • Loading branch information
jeffposnick committed Oct 12, 2020
1 parent ff9d868 commit cbb18c8
Show file tree
Hide file tree
Showing 20 changed files with 4,470 additions and 2,688 deletions.
9 changes: 8 additions & 1 deletion gulp-tasks/test-node.js
Expand Up @@ -56,7 +56,14 @@ async function runNodeTestsWithEnv(testGroup, nodeEnv) {

const packagesToTest = glob.sync(`test/${testGroup}/node`, globConfig);
for (const packageToTest of packagesToTest) {
await runNodeTestSuite(packageToTest, nodeEnv);
// Hardcode special logic for webpack v4 and v5 tests, which need to
// be run in separate processes.
if (packageToTest.includes('workbox-webpack-plugin')) {
await runNodeTestSuite(`${packageToTest}/v4`, nodeEnv);
await runNodeTestSuite(`${packageToTest}/v5`, nodeEnv);
} else {
await runNodeTestSuite(packageToTest, nodeEnv);
}
}
}

Expand Down
11 changes: 9 additions & 2 deletions infra/testing/webpack-build-check.js
Expand Up @@ -6,6 +6,13 @@
https://opensource.org/licenses/MIT.
*/

function joinMessages(errorsOrWarnings) {
if ('message' in errorsOrWarnings[0]) {
return errorsOrWarnings.map((item) => item.message).join('\n');
} else {
return errorsOrWarnings.join('\n');
}
}

module.exports = (webpackError, stats) => {
if (webpackError) {
Expand All @@ -15,10 +22,10 @@ module.exports = (webpackError, stats) => {
const statsJson = stats.toJson('verbose');

if (statsJson.errors.length > 0) {
throw new Error(statsJson.errors.join('\n'));
throw new Error(joinMessages(statsJson.errors));
}

if (statsJson.warnings.length > 0) {
throw new Error(statsJson.warnings.join('\n'));
throw new Error(joinMessages(statsJson.warnings));
}
};
1,661 changes: 1,039 additions & 622 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions package.json
Expand Up @@ -47,6 +47,7 @@
"@rollup/plugin-multi-entry": "^4.0.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-replace": "^2.3.3",
"@types/estree": "0.0.45",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"acorn": "^8.0.1",
Expand Down Expand Up @@ -76,14 +77,15 @@
"globby": "^11.0.1",
"gulp": "^4.0.2",
"gzip-size": "^5.1.1",
"html-webpack-plugin": "^4.3.0",
"html-webpack-plugin": "^4.5.0",
"husky": "^4.2.5",
"jsdoc": "^3.6.5",
"jsdoc-baseline": "^0.1.5",
"lerna": "^3.22.1",
"memory-fs": "^0.5.0",
"minimist": "^1.2.5",
"mocha": "^8.1.1",
"module-alias": "^2.2.2",
"nunjucks": "^3.2.2",
"nyc": "^15.1.0",
"proxyquire": "^2.1.3",
Expand All @@ -99,7 +101,8 @@
"tempy": "^0.6.0",
"typescript": "^3.9.7",
"upath": "^1.2.0",
"webpack": "^4.44.1",
"webpack-v4": "npm:webpack@^4.44.2",
"webpack-v5": "npm:webpack@^5.0.0",
"worker-plugin": "^5.0.0"
}
}

0 comments on commit cbb18c8

Please sign in to comment.