File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5656 "@rollup/plugin-terser" : " ^0.4.4" ,
5757 "autoprefixer" : " ^10.4.21" ,
5858 "browser-sync" : " 3.0.3" ,
59- "connect" : " ^3.7.0" ,
6059 "cross-env" : " ^7.0.3" ,
6160 "editorconfig-checker" : " ^6.0.1" ,
6261 "eslint" : " ^8.57.0" ,
9695 "puppeteer" : " ^24.6.0" ,
9796 "rollup" : " ^4.38.0" ,
9897 "sass-export" : " ^2.1.2" ,
99- "serve-static" : " ^1.16.2" ,
10098 "sitemap" : " ^8.0.0" ,
10199 "slash" : " ^3.0.0" ,
102100 "slug" : " ^9.1.0" ,
Original file line number Diff line number Diff line change 1- const { createServer } = require ( 'http' )
2-
3- const connect = require ( 'connect' )
4- const serveStatic = require ( 'serve-static' )
1+ const browserSync = require ( 'browser-sync' ) . create ( )
52
63const { paths, ports } = require ( '../config' )
74
8- // Create a simple server for serving static files
9- const app = connect ( ) . use ( serveStatic ( paths . public ) )
10- const server = createServer ( app )
5+ browserSync . init (
6+ {
7+ // Prevent browser mirroring
8+ ghostMode : false ,
9+
10+ // Prevent browser opening
11+ open : false ,
12+
13+ // Disable BrowserStack UI
14+ ui : false ,
15+
16+ // Configure port
17+ port : ports . preview ,
1118
12- server . listen ( ports . preview , ( ) => {
13- console . log ( `Server started at http://localhost:${ ports . preview } ` )
14- } )
19+ // Serve files from directory
20+ server : paths . public
21+ } ,
22+ ( err , bs ) => {
23+ if ( err ) {
24+ console . error ( 'Encountered an error starting the local server:' , err )
25+ } else {
26+ console . log (
27+ `Server started at http://localhost:${ bs . options . get ( 'port' ) } `
28+ )
29+ }
30+ }
31+ )
You can’t perform that action at this time.
0 commit comments