Skip to content

fix: remove lazy and filename options #2544

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions bin/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ module.exports = {
type: Boolean,
describe: 'Broadcasts the server via ZeroConf networking on start',
},
{
name: 'lazy',
type: Boolean,
describe: 'Lazy',
},
{
name: 'liveReload',
type: Boolean,
Expand Down
4 changes: 0 additions & 4 deletions bin/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ const options = {
type: 'boolean',
describe: 'Broadcasts the server via ZeroConf networking on start',
},
lazy: {
type: 'boolean',
describe: 'Lazy',
},
liveReload: {
type: 'boolean',
describe: 'Enables/Disables live reloading on changing files',
Expand Down
19 changes: 0 additions & 19 deletions examples/cli/lazy/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions examples/cli/lazy/app.js

This file was deleted.

10 changes: 0 additions & 10 deletions examples/cli/lazy/webpack.config.js

This file was deleted.

9 changes: 1 addition & 8 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ if (!process.env.WEBPACK_DEV_SERVER) {

class Server {
constructor(compiler, options = {}, _log) {
if (options.lazy && !options.filename) {
throw new Error("'filename' option must be set in lazy mode.");
}

validateOptions(schema, options, 'webpack Dev Server');

this.compiler = compiler;
Expand Down Expand Up @@ -763,10 +759,7 @@ class Server {
}

showStatus() {
const suffix =
this.options.inline !== false || this.options.lazy === true
? '/'
: '/webpack-dev-server/';
const suffix = this.options.inline !== false ? '/' : '/webpack-dev-server/';
const uri = `${createDomain(this.options, this.listeningApp)}${suffix}`;

status(
Expand Down
18 changes: 0 additions & 18 deletions lib/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,6 @@
"type": "string"
}
},
"filename": {
"anyOf": [
{
"type": "string"
},
{
"instanceof": "RegExp"
},
{
"instanceof": "Function"
}
]
},
"fs": {
"type": "object"
},
Expand Down Expand Up @@ -192,9 +179,6 @@
}
]
},
"lazy": {
"type": "boolean"
},
"liveReload": {
"type": "boolean"
},
Expand Down Expand Up @@ -445,7 +429,6 @@
"contentBase": "should be {Number|String|Array} (https://webpack.js.org/configuration/dev-server/#devservercontentbase)",
"disableHostCheck": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck)",
"features": "should be {Array}",
"filename": "should be {String|RegExp|Function} (https://webpack.js.org/configuration/dev-server/#devserverfilename-)",
"fs": "should be {Object} (https://github.com/webpack/webpack-dev-middleware#fs)",
"headers": "should be {Object} (https://webpack.js.org/configuration/dev-server/#devserverheaders-)",
"historyApiFallback": "should be {Boolean|Object} (https://webpack.js.org/configuration/dev-server/#devserverhistoryapifallback)",
Expand All @@ -458,7 +441,6 @@
"injectHot": "should be {Boolean|Function} (https://webpack.js.org/configuration/dev-server/#devserverinjecthot)",
"inline": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverinline)",
"key": "should be {String|Buffer}",
"lazy": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverlazy-)",
"liveReload": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverlivereload-)",
"log": "should be {Function}",
"logLevel": "should be {String} and equal to one of the allowed values\n\n [ 'info', 'warn', 'error', 'debug', 'trace', 'silent' ]\n\n (https://github.com/webpack/webpack-dev-middleware#loglevel)",
Expand Down
8 changes: 0 additions & 8 deletions lib/utils/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ function createConfig(config, argv, { port }) {
}
}

if (!options.filename && firstWpOpt.output && firstWpOpt.output.filename) {
options.filename = firstWpOpt.output && firstWpOpt.output.filename;
}

if (!options.watchOptions && firstWpOpt.watchOptions) {
options.watchOptions = firstWpOpt.watchOptions;
}
Expand Down Expand Up @@ -137,10 +133,6 @@ function createConfig(config, argv, { port }) {
options.stats = Object.assign({}, options.stats, { colors: argv.color });
}

if (argv.lazy) {
options.lazy = true;
}

// TODO remove in `v4`
if (!argv.info) {
options.noInfo = true;
Expand Down
20 changes: 0 additions & 20 deletions test/Validation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,6 @@ describe('Validation', () => {
});
});

describe('filename', () => {
afterEach((done) => {
server.close(() => {
done();
});
});

it('should allow filename to be a function', () => {
try {
server = new Server(compiler, { filename: () => {} });
} catch (err) {
if (err === 'ValidationError') {
throw err;
}

throw new Error("Validation failed and it shouldn't");
}
});
});

describe('checkHost', () => {
afterEach((done) => {
server.close(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/Validation.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ exports[`Validation validation should fail validation for invalid \`writeToDisk\
exports[`Validation validation should fail validation for no additional properties 1`] = `
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'additional'. These properties are valid:
object { after?, allowedHosts?, before?, bonjour?, ca?, cert?, clientLogLevel?, compress?, contentBasePublicPath?, contentBase?, disableHostCheck?, features?, filename?, fs?, headers?, historyApiFallback?, host?, hot?, http2?, https?, index?, injectClient?, injectHot?, inline?, key?, lazy?, liveReload?, log?, logLevel?, logTime?, mimeTypes?, noInfo?, onListening?, open?, openPage?, overlay?, pfx?, pfxPassphrase?, port?, profile?, progress?, proxy?, public?, publicPath?, quiet?, reporter?, requestCert?, serveIndex?, serverSideRender?, setup?, sockHost?, sockPath?, sockPort?, socket?, staticOptions?, stats?, transportMode?, useLocalIp?, warn?, watchContentBase?, watchOptions?, writeToDisk? }"
object { after?, allowedHosts?, before?, bonjour?, ca?, cert?, clientLogLevel?, compress?, contentBasePublicPath?, contentBase?, disableHostCheck?, features?, fs?, headers?, historyApiFallback?, host?, hot?, http2?, https?, index?, injectClient?, injectHot?, inline?, key?, liveReload?, log?, logLevel?, logTime?, mimeTypes?, noInfo?, onListening?, open?, openPage?, overlay?, pfx?, pfxPassphrase?, port?, profile?, progress?, proxy?, public?, publicPath?, quiet?, reporter?, requestCert?, serveIndex?, serverSideRender?, setup?, sockHost?, sockPath?, sockPort?, socket?, staticOptions?, stats?, transportMode?, useLocalIp?, warn?, watchContentBase?, watchOptions?, writeToDisk? }"
`;
2 changes: 0 additions & 2 deletions test/fixtures/schema/webpack.config.no-dev-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ module.exports = {
socket: '_socket',
progress: '_progress',
publicPath: '_publicPath',
filename: '_filename',
hot: '_hot',
clientLogLevel: '_clientLogLevel',
contentBase: '_contentBase',
watchContentBase: '_watchContentBase',
lazy: '_lazy',
noInfo: '_noInfo',
quiet: '_quiet',
https: '_https',
Expand Down
18 changes: 0 additions & 18 deletions test/options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ describe('options', () => {
success: [['before'], []],
failure: [false],
},
filename: {
success: ['', new RegExp(''), () => {}],
failure: [false],
},
fs: {
success: [
{
Expand Down Expand Up @@ -219,20 +215,6 @@ describe('options', () => {
success: ['', Buffer.from('')],
failure: [false],
},
lazy: {
success: [
{
lazy: true,
filename: '.',
},
],
failure: [
{
lazy: '',
filename: '.',
},
],
},
log: {
success: [() => {}],
failure: [''],
Expand Down
1 change: 0 additions & 1 deletion test/ports-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const portsList = {
'http2-option': 1,
'https-option': 1,
'inline-option': 1,
'lazy-option': 1,
'liveReload-option': 1,
'mineTypes-option': 1,
'onListening-option': 1,
Expand Down
30 changes: 0 additions & 30 deletions test/server/lazy-option.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/server/open-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('open option', () => {
server.close(() => {
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"http://localhost:8119/",
"http://localhost:8118/",
Object {
"wait": false,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`WebsocketServer should receive connection, send message, and close client 1`] = `"localhost:8130"`;
exports[`WebsocketServer should receive connection, send message, and close client 1`] = `"localhost:8129"`;

exports[`WebsocketServer should receive connection, send message, and close client 2`] = `
Array [
Expand Down
Loading