Skip to content

Can't be installed if Webpack 5 is already a dependency #237

@ggat

Description

@ggat
  • Webpack Version: v4, v5
  • Operating System (or Browser): MacOS Monterey
  • Node Version: v14.15.4
  • webpack-plugin-serve Version: 1.5.0

How Do We Reproduce?

Latest package.json specifies webpack-plugin-ramdisk@^0.1.2 which allows for 0.1.8 to be installed but not 0.2.0. This has to do with https://semver.org/#spec-item-4 and npm semantic versioning rules.

https://nodejs.dev/learn/semantic-versioning-using-npm

It will only do updates that do not change the leftmost non-zero number

Unlike ramdisk 0.2.0, 0.1.8 is limited to wepback 4 as a peer dependency and if webpack 5 is already present in the project, the installation results in peer dependency conflict error.

Make sure npm@7.*.* is used.

Setup a fresh npm project, install webpack, and then install webpack-plugin-serve

mkdir tmp-project
cd tmp-project
npm init -y
npm i webpack -D
npm i webpack-plugin-serve -D

Expected Behavior

webpack-plugin-serve gets installed

Actual Behavior

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: webpack@5.67.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^5.1.0" from terser-webpack-plugin@5.3.0
npm ERR!   node_modules/terser-webpack-plugin
npm ERR!     terser-webpack-plugin@"^5.1.3" from webpack@5.67.0
npm ERR!   dev webpack@"^5.67.0" from the root project
npm ERR!   1 more (webpack-plugin-serve)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.20.0" from webpack-plugin-ramdisk@0.1.8
npm ERR! node_modules/webpack-plugin-serve/node_modules/webpack-plugin-ramdisk
npm ERR!   webpack-plugin-ramdisk@"^0.1.2" from webpack-plugin-serve@1.5.0
npm ERR!   node_modules/webpack-plugin-serve
npm ERR!     dev webpack-plugin-serve@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Proposal

If we do actually mean any minor updates by ^0.1.2 it should be changed to 0.*

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions