I'm using the lite-server
with npm run lite
my config file,
module.exports = {
"server": { "baseDir": "./src" }
};
whenever I start the server, it opens up a new browser window. How do I prevent lite server opening browser window on server startup?
thanks.
Use the key combination CTRL + C .
Lite-server is a lightweight development server that serves a web application, opens it in the browser, and refreshes the page when HTML or JavaScript changes are made to the source code.
bsconfig. json is the single, mandatory build meta file needed for rescript . The complete configuration schema is here. We'll non-exhaustively highlight the important parts in prose below.
It seems like browserSync
has option open: false
https://www.browsersync.io/docs/options/#option-open
try in your bs-config.js
module.exports = {
"server": { "baseDir": "./src" },
"open": false
};
Or in bs-config.json
in your project's folder:
{
"server": { "baseDir": "./src" },
"open": false
}
Lite-server uses
BrowserSync
And allows for configuration overrides
via a local
bs-config.json
or
bs-config.js
file in your project.
The default behavior of the server serves from the current folder
, opens a browser
, and applies an HTML5 route fallback to ./index.html.
so we need to set the configuration
For example, to change the server port, watched file paths, and base directory for your project, create a bs-config.json
in your project's folder:
{
"port": 8000,
"files": ["./src/**/*.{html,htm,css,js}"],
"server": { "baseDir": "./src" }
}
So for browser not opening you have to set like this
{
"port": 8000,
"files": ["./src/**/*.{html,htm,css,js}"],
"server": { "baseDir": "./src" },
"open":false
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With