emit a basepath event on first run

This commit is contained in:
Rich Harris
2018-06-14 17:20:46 -04:00
parent 9c4a3592ff
commit 9eeeaa24c1
4 changed files with 35 additions and 3 deletions

View File

@@ -6,7 +6,6 @@ import * as ports from 'port-authority';
import mkdirp from 'mkdirp';
import rimraf from 'rimraf';
import format_messages from 'webpack-format-messages';
import prettyMs from 'pretty-ms';
import { locations } from '../config';
import { EventEmitter } from 'events';
import { create_routes, create_main_manifests, create_compilers, create_serviceworker_manifest } from '../core';
@@ -172,6 +171,14 @@ class Watcher extends EventEmitter {
}, process.env),
stdio: ['ipc']
});
this.proc.on('message', message => {
if (message.__sapper__ && message.event === 'basepath') {
this.emit('basepath', {
basepath: message.basepath
});
}
});
});
}
});