Browserslist update with rush and pnpm doesn't work

See original GitHub issue

I use rush to manage a big monorepo. It has many subprojects. Rush stores no individual lock file and instead keeps one big lock file in a central location.

While building with rush my subprojects output the following error:

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

When I cd into a subproject and run pnpx browserslist@latest --update-db it crashes with the following error: No lockfile found. Run "npm install", "yarn install" or "pnpm install"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
wberncommented, Jun 16, 2021

I made a script to bump only caniuse-lite (since rush update --full is a rather disruptive operation just for this package to be updated).

Here is a script that I made. Make sure it exists under scripts/ in your monorepo, since I hard-coded paths to navigate to root from there (or you can just alter the code).

https://gist.github.com/wbern/1f560e2ea3fc7093743c8107a0e105e2

1reaction
Measycommented, Aug 18, 2021

You can just write a .pnpmfile.cjs readPackage hook, and run rush update --recheck; As @wbern mentioned,rush update --full is a rather disruptive operation just for this package to be updated

function readPackage(packageJson, context) {

  // // The karma types have a missing dependency on typings from the log4js package.
  // if (packageJson.name === '@types/karma') {
  //  context.log('Fixed up dependencies for @types/karma');
  //  packageJson.dependencies['log4js'] = '0.6.38';
  // }
  if (packageJson.dependencies && packageJson.dependencies['caniuse-lite']) {
    packageJson.dependencies['caniuse-lite'] = '^1.0.30001251';
    context.log(`${packageJson.name} caniuse-lite use ^1.0.30001251`)
  }

  return packageJson;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Rushstack CI blocked by "browerslist update" warning #2981
It's not super clear how to fix this warning, running the suggested command in one of the affected projects doesn't work because there's...
Read more >
caniuse-lite is outdated. Please run next command `npm ...
First, as the message says, I ran npm update caniuse-lite browserslist but it didn't fix the issue. I deleted the whole node_modules directory ......
Read more >
rushstack/rushstack - Gitter
Hi! Our monorepo has a bunch of different apps, and all apps currently have their own pipelines that trigger if e.g. apps/my-app/* changed....
Read more >
browserslist - Bountysource
When using Yarn v2, running npx browserslist@latest --update-db fails with the error Cannot read property '1' of null . Calling yarn run browserslist ......
Read more >
Build a scalable front-end with Rush monorepo and React
Run rush update to install all dependencies and let's try to build ... to use browserslist from package.json from @monorepo/react-scripts .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found