Skip to content

Watch Options: Cannot read property 'poll' of undefineds #1217

@birdwell

Description

@birdwell

Please note that this template is not optional. If you proceed with this form,
please fill out all fields, or your issue may be closed as "invalid."
Please do not delete this template. Please ask questions on StackOverflow or the
webpack Gitter (https://gitter.im/webpack/webpack). General questions, how-to
questions, and support requests will be closed.

Please do remove this header to acknowledge this message.

  • Operating System: macOS High Sierra
  • Node Version: v9.2.0
  • NPM Version: 5.5.1
  • webpack Version: 3.10.0
  • webpack-dev-server Version: 2.9.6
  • This is a bug
  • This is a feature request
  • This is a modification request

Code

TypeError: Cannot read property 'poll' of undefined
    at Server._watch (my_project/node_modules/webpack-dev-server/lib/Server.js:670:40)
    at Object.watchContentBase (my_project/node_modules/webpack-dev-server/lib/Server.js:322:14)
    at Server.forEach (my_project/node_modules/webpack-dev-server/lib/Server.js:372:22)
    at Array.forEach (<anonymous>)
    at new Server (my_project/node_modules/webpack-dev-server/lib/Server.js:371:41)
    at startDevServer (my_project/node_modules/webpack-dev-server/bin/webpack-dev-server.js:381:14)
    at processOptions (my_project/node_modules/webpack-dev-server/bin/webpack-dev-server.js:345:5)
    at Object.<anonymous> (my_project/node_modules/webpack-dev-server/bin/webpack-dev-server.js:489:1)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)`
  // webpack.config.js
'use strict';
const path = require('path');

module.exports = {
	entry: {
		index: [
			path.resolve(__dirname, './src/index.js')
		]
	},
	externals: [],
	output: {
		path: '/',
		filename: 'index.js'
		// publicPath: '/'
	},
	devServer: {
		contentBase: path.resolve(__dirname, './src'),
		watchContentBase: true
	}
};
  // additional code, remove if not needed.

Expected Behavior

npm start would start the dev server.

Actual Behavior

npm start throws this error.

For Bugs; How can we reproduce the behavior?

watchContentBase is the trigger for the bug.

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

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