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

Update quilt packages to support webpack 5 #2013

Merged
merged 8 commits into from
Dec 1, 2021
Merged

Update quilt packages to support webpack 5 #2013

merged 8 commits into from
Dec 1, 2021

Conversation

vsumner
Copy link
Collaborator

@vsumner vsumner commented Aug 26, 2021

Description

This PR updates packages with webpack support to version 5.

Fixes (issue #)

Type of change

  • @shopify/jest-dom-mocks Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • graphql-mini-transforms Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • @shopify/react-server Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • @shopify/sewing-kit-koa Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • @shopify/web-worker Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above (Documentation fix and Test update does not need a changelog as we do not publish new version)

@michenly michenly changed the title [DO NOT MERGE] Update graphql-mini-transforms to support webpack 5 [DO NOT MERGE] Update quilt packages to support webpack 5 Aug 26, 2021
@shopify-shipit shopify-shipit bot temporarily deployed to michenly-beta August 26, 2021 17:50 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to michenly-beta August 30, 2021 15:39 Inactive
@vsumner vsumner force-pushed the webpack-5 branch 3 times, most recently from dbb83fc to a778d68 Compare November 25, 2021 02:26
@shopify-shipit shopify-shipit bot temporarily deployed to michenly-beta November 25, 2021 02:39 Inactive
@vsumner vsumner force-pushed the webpack-5 branch 2 times, most recently from c008ab4 to 5dd5e31 Compare November 30, 2021 19:09
Co-authored-by: Michelle Chen <[email protected]>
Co-authored-by: Ates Goral <[email protected]>"
@vsumner vsumner changed the title [DO NOT MERGE] Update quilt packages to support webpack 5 Update quilt packages to support webpack 5 Nov 30, 2021
@vsumner vsumner marked this pull request as ready for review November 30, 2021 20:39
@vsumner vsumner requested a review from a team November 30, 2021 20:39
"@types/loader-utils": "^1.1.3",
"common-tags": "^1.8.0"
"common-tags": "^1.8.0",
"webpack": "^5.40.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Copy link
Member

@BPScott BPScott left a comment

Choose a reason for hiding this comment

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

I'm assuming this looks good as I'm very light on webpack context.

One question: Previously we had had webpack dependencies for ^4.BLAH (as single major version) and we've widened them up to >=5.BLAH so now when webpack 6 comes along these packages will claim to work. Do we feel good about that being the case in webpack 6? (In the past we've done this for lint tooling where we doubt be public API will change much but it seems like when webpack does a major version everything changes.)

"webpack": "^5.40.0"
},
"peerDependencies": {
"webpack": ">=5.38.0"
Copy link
Member

Choose a reason for hiding this comment

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

Is webpack here used just for types? If that's the case can we mark it as an optional peer dependency? https://github.com/Shopify/loom/blob/06c44051385af276a1982a583b34aeac6160c75f/packages/loom-plugin-babel/package.json#L45-L48

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. Updated.

@BPScott
Copy link
Member

BPScott commented Nov 30, 2021

Bonsu thought: Whats the migration path like for these packages? Is there anything that consumers need to change as part of bumping to the new major versions?

{...options, kind: AssetKind.Scripts},
await this.getResolvedManifest(options.locale),
);

const scripts =
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a breaking change that should have some attention drawn to it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah right. We dropped the vendor dll in sewing-kit.

"node-loader": "^1.0.0",
"react": "^17.0.2",
"react-dom": "17.0.2",
"saddle-up": "^0.5.4",
"setimmediate": "^1.0.5",
"webpack": "^4.25.1"
"webpack": ">=5.40.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be 5.38?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep! Fixed

@@ -61,7 +59,7 @@ async function loadDocument(
loader.resolve(resolveContext, imported, (error, result) => {
if (error) {
reject(error);
} else {
} else if (result) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still want a default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. Updated.

const serverModule = getModule(serverResults, 'server');
const [client, clientIndex, server] = await runBuild(name, [
DEFAULT_CLIENT_FILE_PATH,
'client/index.js',
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems strange that you pass two client entries and return all three.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The provided list is a list of files we want to test the contents of.
So its asking for the contents of:
DEFAULT_CLIENT_FILE_PATH, client/index.js, DEFAULT_SERVER_FILE_EPATH.
It doesn't affect the compilation and is just a test utility.

There is a mistake in that EPATH should be PATH.

const compiler: Compiler = webpack(contextConfig);
compiler.outputFileSystem = new MemoryOutputFileSystem({});
// We use memfs.fs to prevent webpack from outputting to our actual FS
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@@ -65,7 +65,7 @@ export function runWebpack(
(error, stats) => {
if (error) {
reject(error);
} else if (stats.hasErrors()) {
} else if (stats && stats.hasErrors()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

stats can now be falsy in v5?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

they can be undefined.

version "8.4.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.4.0.tgz#af53266e698d7cffa416714b503066a82221be60"
integrity sha512-ULr0LDaEqQrMFGyQ3bhJkLsbtrQ8QibAseGZeaSUiT/6zb9IvIkomWHJIvgvwad+hinRAgsI51JcWk2yvwyL+w==
acorn@^8.2.4, acorn@^8.4.1:
Copy link
Contributor

Choose a reason for hiding this comment

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

We have both acorn 7 and 8?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. 7 is still here because of espree which is imported by loom.

=> Found "espree#[email protected]"
info This module exists because "_project_#@shopify#loom-plugin-eslint#eslint#espree" depends on it.
=> Found "acorn-globals#[email protected]"
info This module exists because "_project_#@shopify#loom-plugin-jest#jest#@jest#core#jest-config#jest-environment-jsdom#jsdom#acorn-globals" depends on it.

I think @BPScott recent work updating web-configs will help here.

Copy link
Member

@BPScott BPScott Dec 1, 2021

Choose a reason for hiding this comment

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

Indeedy my eslint 8 PR bumps espree from v7.x to v9.x, which in turn bumps the transitive dep on acorn from 7.x to 8.x. Which fixes the eslint transitive dependency. Nothing to fix the jsdom one though

string_decoder "^1.1.1"
util-deprecate "^1.0.1"

readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@~2.3.6:
Copy link
Contributor

Choose a reason for hiding this comment

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

dedupe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried, I haven't been able too

Copy link
Contributor

Choose a reason for hiding this comment

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

🌮

Copy link
Contributor

@dahukish dahukish left a comment

Choose a reason for hiding this comment

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

Couple of small questions but nothing major. 🏅

@caution-tape-bot
Copy link

👋 It looks like you're updating JavaScript packages that are known
to cause problems when duplicated.

You can deduplicate them with the yarn-deduplicate utility:

npx yarn-deduplicate --packages graphql react react-dom webpack
npx yarn-deduplicate --scopes @shopify @apollo

A duplicate React version may cause an invalid hook call warning.

React context providers usually use module-scoped globals as their
default context values. Multiple versions of such packages will yield
multiple global instances, resulting in oblique runtime errors.

@vsumner
Copy link
Collaborator Author

vsumner commented Dec 1, 2021

Bonsu thought: Whats the migration path like for these packages? Is there anything that consumers need to change as part of bumping to the new major versions?

They just need to be on webpack 5. They are drop in replacements with no actual changes other than the webpack dependency update.

@ghost ghost added the cla-needed label Dec 1, 2021
@vsumner vsumner merged commit d15ab45 into main Dec 1, 2021
@vsumner vsumner deleted the webpack-5 branch December 1, 2021 15:20
@shopify-shipit shopify-shipit bot temporarily deployed to production December 1, 2021 15:36 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to production-ssr-tryrequire-errors-beta December 16, 2021 19:05 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to gem January 10, 2022 10:18 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants