23 lines
552 B
JavaScript
23 lines
552 B
JavaScript
|
const port = 9000;
|
||
|
const distPath = 'www';
|
||
|
// express server
|
||
|
const { join } = require('path');
|
||
|
const express = require('express');
|
||
|
const app = express();
|
||
|
app
|
||
|
.use(express.static(distPath))
|
||
|
.use('/src', express.static(join(__dirname, 'src')))
|
||
|
.get(/^[^.]*$/, (req, rep) =>
|
||
|
rep.sendFile(join(__dirname, distPath, '/index.html')),
|
||
|
)
|
||
|
.listen(port);
|
||
|
// browser sync
|
||
|
const bs = require('browser-sync').create();
|
||
|
bs.init({
|
||
|
files: [distPath + '/**/*'],
|
||
|
proxy: `http://localhost:${port}`,
|
||
|
open: false,
|
||
|
notify: false,
|
||
|
//tunnel: true,
|
||
|
});
|