PDA

View Full Version : How to turn off automatically open browser after webpack-dev-server starts ?



21 Oct 2019, 9:58 AM
Hi,
I am using ExtAngular 7, and I want to not automatically open browser tab whenever I start my local server.
In webpack.config.js, I tried to set open: false for devServer block:

devServer: {
contentBase: outputFolder,
historyApiFallback: true,
hot: !isProd,
host: '0.0.0.0',
port: port,
open: false,
disableHostCheck: false,
compress: isProd,
inline: !isProd,
stats: 'none'
}
However, when I start, ext plugin will still open new browser tab:


ℹ 「ext」: Opening browser at http://localhost:4501
ℹ 「ext」: Ending development build for angular
ℹ 「wdm」: Compiled successfully.

lenraff
4 Nov 2019, 4:51 AM
In pluginUtil.js of the sencha webpack plugin module, there are the following lines:


if (options.browser == true && options.watch == 'yes' && vars.production == false) { if (vars.browserCount == 0) {
var url = 'http://localhost:' + options.port;


require('./pluginUtil').log(vars.app + `Opening browser at ${url}`);


vars.browserCount++;


const opn = require('opn');


opn(url);
}
}

You can either unset the options.watch parameter to something different or if that doesn't work comment out those lines.