diff --git a/lib/util/addDevServerEntrypoints.js b/lib/util/addDevServerEntrypoints.js index d3d95b3a32..8007049008 100644 --- a/lib/util/addDevServerEntrypoints.js +++ b/lib/util/addDevServerEntrypoints.js @@ -27,7 +27,7 @@ module.exports = function addDevServerEntrypoints(webpackOptions, devServerOptio } else if (typeof wpOpt.entry === 'function') { wpOpt.entry = wpOpt.entry(devClient); } else { - wpOpt.entry = devClient.concat(wpOpt.entry); + wpOpt.entry = devClient.concat(wpOpt.entry || './src'); } }); } diff --git a/test/Entry.test.js b/test/Entry.test.js new file mode 100644 index 0000000000..1ccb2ae6e9 --- /dev/null +++ b/test/Entry.test.js @@ -0,0 +1,18 @@ +'use strict'; + +const assert = require('assert'); +const addDevServerEntrypoints = require('../lib/util/addDevServerEntrypoints'); + +describe('Entry', () => { + it('default to src if no entry point is given', (done) => { + const webpackOptions = {}; + const devServerOptions = {}; + + addDevServerEntrypoints(webpackOptions, devServerOptions); + + assert(webpackOptions.entry.length, 2); + assert(webpackOptions.entry[1], './src'); + + done(); + }); +});