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

workbox-build@6.2.0 not compatible with workbox-webpack-plugin@6.0.2 #2904

Closed
tjwiebell opened this issue Aug 6, 2021 · 8 comments
Closed
Labels
Bug An issue with our existing, production codebase. workbox-build workbox-webpack-plugin

Comments

@tjwiebell
Copy link

tjwiebell commented Aug 6, 2021

Library Affected:
workbox-webpack-plugin

Browser & Platform:
n/a

Issue or Feature Request Description:
After 6.2.0 was published yesterday, our project that is constrained to workbox-webpack-plugin: ~6.0.2 started failing with zero changes to our code base. It appears the constraint in this package workbox-build: ^6.0.2 causes an upgrade to 6.2.0, which does not appear to be backward compatible with 6.0.2 of the plugin.

Error: Cannot find module 'workbox-build/build/options/schema/webpack-generate-sw'

Our workaround for now is to fix workbox-build back to 6.0.2 using resolution fixing:

"resolutions": {
    "workbox-build": "~6.0.2"
}

We've put out the fire on our end, but I can imagine anyone else using conservative constraints like our project will also run into build failures after yesterday's release. Please let me know if you have any questions or need additional detail.

@jeffposnick
Copy link
Contributor

Hello @tjwiebell—For a while now, we've used lerna to version and publish all the modules in our monorepo in concert with each other, and our intention is that folks use the same version of all the Workbox modules at the same time. We do make changes in one module that rely on other modules also being updated as part of minor/patch semver releases.

I'm going to take a look at the lerna config options a bit more closely to see if we can change our build setup to use exact version numbers instead of ^-prefixed ones for the mutual dependencies, as that would clearly enforce that expected requirement.

Could you explain a bit more about your motivations around how you're accomplishing these versioning constraints on your end? Are you using yarn or npm or something else?

@jeffposnick jeffposnick added Bug An issue with our existing, production codebase. workbox-build workbox-webpack-plugin labels Aug 6, 2021
@tjwiebell
Copy link
Author

We have a package in our monorepo that is used as a template for our creator starter kit, which support both yarn create and npm init; similar to the create-react-app flow. I do not recall the motivation behind being conservative with our constraints, but I think issues with backward incompatible updates in dependencies we don't control was an issue in the past.

@jeffposnick
Copy link
Contributor

Gotcha. I've filed #2906 and I'm going to give that change a try soon with a pre-release publish to npm, as it's really hard to test the actual lerna flow without doing a publish. Assuming that looks as expected, I'll flag it as latest on npm.

I don't think that change is going to address the 6.0.2 vs. 6.2.0 compatibility issue retroactively, because 6.2.0 was written with the assumption that all of the mutual dependencies would also use 6.2.0, and it's not going to be trivial to undo that. But moving forward, for 6.2.1 on, I hope that our dependencies will accurately reflect that intention.

@jeffposnick
Copy link
Contributor

Unfortunately, it looks like lerna will always add in a leading ^ when it bumps the mutual dependencies prior to a publish, so removing it ahead of the publish didn't help:

"workbox-build": "^6.2.1"

I'm going to dig a bit deeper into our options here.

Also, if there's anyone who is currently stuck due to a similar situation to what was outlined above and can't work around it, please chime in and let us know. I guess it would be possible (if less than ideal) to re-add the old validation logic to workbox-build that workbox-webpack-plugin v6.0.x and v6.1.x relied on, but that would end up being a bit of a hack, and either updating all the Workbox libraries to v6.2.x, or explicitly adding dependencies on the same version numbers, would be the recommended path.

@jeffposnick
Copy link
Contributor

Ah, we need to use the --exact flag in lerna.

@jeffposnick
Copy link
Contributor

Okay, release v6.2.2 uses the --exact flag, so we should hopefully not run into the same issue in the future.

I'll leave this issue open to evaluate the impact on developers who are stuck for some reason on a mismatched older version of the Workbox libraries.

@jeffposnick
Copy link
Contributor

...I'm going to close this, and apologies again for any issues that the 6.2.0 release raised. Moving forward, the --exact flag in our lerna releases should ensure that all of our modules depend on the exact versions that we had expected them to be used with.

@tjwiebell
Copy link
Author

No worries @jeffposnick, thanks for the lightning fast response. Can confirm upgrading to 6.2.2 has remedied this without the need for fixed resolution anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An issue with our existing, production codebase. workbox-build workbox-webpack-plugin
Projects
None yet
Development

No branches or pull requests

2 participants