-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbrowse.js
33 lines (30 loc) · 790 Bytes
/
browse.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Script to start development server, inject hot reloading and start browser
// Usage: npm run browse
var bs = require("browser-sync").create();
var fs = require('fs')
function buildIndex() {
fs.readFile('index.html', 'utf8', function (err, data) {
var result = data.replace(/bundle.min.mjs/g, 'bundle.mjs');
fs.writeFile('index.dev.html', result, 'utf8', function (err) {
if (err) return console.log(err);
});
});
}
buildIndex();
bs.init({
files: [
{
match: ['index.html'],
fn: buildIndex,
},
'index.dev.html',
'build/*.js',
'build/*.mjs',
'*.css',
],
serveStatic: ['./build'],
server: {
baseDir: '.',
index: 'index.dev.html',
},
})