Skip to content

Implicit dependency on webpack-cli #1422

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

Closed
2 tasks done
daaain opened this issue Jun 14, 2018 · 4 comments
Closed
2 tasks done

Implicit dependency on webpack-cli #1422

daaain opened this issue Jun 14, 2018 · 4 comments

Comments

@daaain
Copy link

daaain commented Jun 14, 2018

  • Operating System: Mac OS 10.13.4
  • Node Version: v8.11.1
  • NPM Version: 6.1.0
  • webpack Version: 4.12.0
  • webpack-dev-server Version: 3.1.4
  • This is a bug
  • This is a modification request

Code

N/A

Expected Behavior

That webpack-dev-server works with webpack-command.

Or if it specifically needs webpack-cli it's made an explicit dependency.

Actual Behavior

webpack-dev-server crashes as it's trying to directly access webpack-cli/bin/config-yargs.

> webpack-dev-server --mode development --hot

The CLI moved into a separate package: webpack-cli.
Please install 'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D
module.js:549
    throw err;
    ^

Error: Cannot find module 'webpack-cli/bin/config-yargs'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/xxx/node_modules/webpack-dev-server/bin/webpack-dev-server.js:65:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

For Bugs; How can we reproduce the behavior?

Create a project with webpack-command and without webpack-cli

For Features; What is the motivation and/or use-case for the feature?

@greggb
Copy link

greggb commented Jun 14, 2018

I was just about to open this same ticket.

Going forward should we expect webpack-dev-server to only pair with webpack-cli and webpack-command to pair with webpack-serve?

My use case in this situation is not having the time to update my configs for webpack-serve at the moment, so I wanted to retain dev-server while having already moved to webpack-command. Might not be a common enough use case though.

@shellscape
Copy link
Contributor

webpack-serve has no dependency on webpack-command. The choice to have webpack-dev-server depend on the CLI for webpack was a poor design decision made many moons ago, but the ecosystem was much more tightly coupled back then, so it wasn't obvious. This does present a problem for people using webpack-dev-server, especially considering the effort to deprecate webpack-cli currently underway.

@leonid-shevtsov
Copy link

Additionally, webpack-dev-server won't start in a Yarn Plug'n'Play-enabled project because p'n'p does not allow implicit dependencies:

Error: Package "[email protected]" (via ".../node_modules/webpack-dev-server/bin/webpack-dev-server.js") is trying to require the package "webpack-cli" (via "webpack-cli/bin/config-yargs") without it being listed in its dependencies (webpack, ansi-html, bonjour, chokidar, compression, connect-history-api-fallback, debug, del, express, html-entities, http-proxy-middleware, import-local, internal-ip, ip, killable, loglevel, opn, portfinder, schema-utils, selfsigned, semver, serve-index, sockjs, sockjs-client, spdy, strip-ansi, supports-color, url, webpack-dev-middleware, webpack-log, yargs, webpack-dev-server)

@alexander-akait
Copy link
Member

Close in favor #616 (comment). We solve this for v4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants