Skip to content

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

@jpreynat

Description

@jpreynat
  • 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 [email protected] and [email protected] alongside [email protected].

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 [email protected] with [email protected] and [email protected] 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions