Skip to content

webpack-dev-server should work with webpack 5 and webpack-cli #2239

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
1 of 2 tasks
jpreynat opened this issue Sep 5, 2019 · 8 comments · Fixed by #2359
Closed
1 of 2 tasks

webpack-dev-server should work with webpack 5 and webpack-cli #2239

jpreynat opened this issue Sep 5, 2019 · 8 comments · Fixed by #2359

Comments

@jpreynat
Copy link

jpreynat commented Sep 5, 2019

  • Operating System: MacOS 10.15
  • Node Version: 8.15.0
  • NPM Version: yarn 1.17.3
  • webpack Version: 5.0.0-alpha.23
  • webpack-dev-server Version: 3.8.0
  • Browser: None yet
  • This is a bug
  • This is a modification request

Code

// webpack.config.js
// Here is a minimal config that fails
{
    target: 'web',
    mode: IS_DEV ? 'development' : 'production',
    context: path.resolve('./src'),
    resolve: {
        extensions: ['.js', '.ts', '.tsx']
    }
}

Expected Behavior

webpack-dev-server should be able to work with webpack 5.

Actual Behavior

I am running webpack-dev-server@3.8.0 and webpack-cli@3.3.7 alongside webpack@5.0.0-alpha.23.

Simply running the $ yarn webpack-dev-server command is launching the server correctly, but as soon as I pass it our actual config file with $ yarn webpack-dev-server --config <path-to-config>.js, it is failing with the following error:

/node_modules/webpack-cli/bin/utils/convert-argv.js:140
		if (webpackConfigurationValidationErrors.length) {
		                                         ^

TypeError: Cannot read property 'length' of undefined
    at processConfiguredOptions (/node_modules/webpack-cli/bin/utils/convert-argv.js:140:44)
    at module.exports (/node_modules/webpack-cli/bin/utils/convert-argv.js:131:10)
    at Object.<anonymous> (/node_modules/webpack-dev-server/bin/webpack-dev-server.js:84:40)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)

I tried removing most of the config, but it seems to fail as soon as a config file is passed.

For Bugs; How can we reproduce the behavior?

Starting webpack-dev-server@3.8.0 with webpack-cli@3.3.7 and webpack@5.0.0-alpha.23 with the --config flag.

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

Adding long-term support for webpack 5 to benefit from its major updates.

@alexander-akait
Copy link
Member

We need setup webpack@5 in CI to ensure all works fine, i think only cli broken

@artemkaint
Copy link

+1

@jpreynat
Copy link
Author

Indeed, this is now resolved using webpack@5.0.0-alpha.26 with webpack-cli@3.3.8.
Thanks @evilebottnawi

@alexander-akait
Copy link
Member

Keep open until we set up CI

@JoshuaKGoldberg
Copy link

configYargsPath = 'webpack-cli/bin/config-yargs';

webpack-cli/bin/ no longer exists as of (webpack/webpack-cli@82407e5). This is a blocker for at least webpack-cli@4.0.0-alpha-5. Is there a workaround...?

@alexander-akait
Copy link
Member

@JoshuaKGoldberg we try to solve this for next release

@jasonwilliams
Copy link

im getting..
warning " > webpack-dev-server@3.9.0" has incorrect peer dependency "webpack@^4.0.0".

guessing its down to this thread still being open

@alexander-akait
Copy link
Member

@jasonwilliams ignore this, we update peerDeps field after stable release

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

Successfully merging a pull request may close this issue.

5 participants