forked from angular-architects/module-federation-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserve.js
More file actions
31 lines (25 loc) · 608 Bytes
/
serve.js
File metadata and controls
31 lines (25 loc) · 608 Bytes
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
const dist = 'dist/apps/playground';
const src = 'apps/playground';
const appName = 'playground';
const port = 3000;
const watch = require('node-watch');
const spawn = require('cross-spawn');
var browserSync = require('browser-sync');
function build(appName) {
spawn.sync('npx', ['nx', 'build', appName], { stdio: 'inherit' });
}
build(appName);
const bsInstance = browserSync.create();
bsInstance.init({
server: {
baseDir: dist,
index: 'index.html',
},
port: port,
cors: true,
browser: true,
});
watch(src, { recursive: true }, () => {
build(appName);
bsInstance.reload();
});