flow icon indicating copy to clipboard operation
flow copied to clipboard

Vite projects do not work with pnpm 7

Open Artur- opened this issue 2 years ago • 1 comments

Description of the bug

Running npx pnpm@7 i in a project using Vite results in

 ERR_PNPM_PEER_DEP_ISSUES  Unmet peer dependencies

.
└─┬ @rollup/plugin-replace
  ├── ✕ missing peer rollup@"^1.20.0 || ^2.0.0"
  └─┬ @rollup/pluginutils
    └── ✕ missing peer rollup@^1.20.0||^2.0.0
Peer dependencies that should be installed:
  rollup@">=1.20.0 <2.0.0 || >=2.0.0 <3.0.0"  

The rollup plugins are used from Vite but have a peer dependency to rollup.

pnpm 7 uses strict peer dependencies by default: https://github.com/pnpm/pnpm/pull/4427

Expected behavior

The rollup plugins are installed, rollup is not installed.

Minimal reproducible example

pnpm i with the default dev dependencies:

{
  "name": "no-name",
  "license": "UNLICENSED",
  "devDependencies": {
    "@rollup/plugin-replace": "3.1.0",
    "async": "3.2.2",
    "glob": "7.1.6",
    "mkdirp": "1.0.4",
    "rollup-plugin-brotli": "3.1.0",
    "typescript": "4.5.3",
    "vite": "v2.9.1",
    "vite-plugin-checker": "0.3.4",
    "workbox-build": "6.5.0",
    "workbox-core": "6.5.0",
    "workbox-precaching": "6.5.0"
  }
}

Versions

Vaadin: 1.1.0.alpha3 Flow: 23.1.0.alpha3 Java: Homebrew 17.0.1 OS: aarch64 Mac OS X 12.3.1 Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36 Live reload: Java active (Spring Boot Devtools): Front end active

Artur- avatar May 03 '22 15:05 Artur-

  "pnpm": {
    "peerDependencyRules": {
      "ignoreMissing": ["rollup"]
    }
  }

in package.json when using pnpm might be a better solution than the workaround in #13668

Artur- avatar May 03 '22 16:05 Artur-

This was fixed in #13668

Artur- avatar Jan 27 '23 07:01 Artur-