forcing webpackdev server to write files

This commit is contained in:
Malar Kannan
2017-07-18 16:29:16 +05:30
parent bc31135c2d
commit 726e81c88e
5 changed files with 33 additions and 20 deletions

View File

@@ -112,14 +112,10 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
// process.exit(1);
// }
// );
fs.emptyDirSync(paths.appBuild);
fs.ensureSymlink(paths.appPng,path.resolve(paths.appBuild,'png'));
// Merge with the public folder
copyPublicFolder();
startWebPackDevServer(()=>{
child_process.spawn('webpack',['--watch','--config','config/webpack.config.flask.js'],{
stdio:'inherit'
});
// child_process.spawn('webpack',['--watch','--config','config/webpack.config.flask.js'],{
// stdio:'inherit'
// });
child_process.spawn('python',['walle-server.py'],{
stdio:'inherit'
});
@@ -173,7 +169,10 @@ function copyPublicFolder() {
function startWebPackDevServer(pyServer){
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
const HOST = process.env.HOST || '0.0.0.0';
fs.emptyDirSync(paths.appBuild);
fs.ensureSymlink(paths.appPng,path.resolve(paths.appBuild,'png'));
// Merge with the public folder
copyPublicFolder();
// We attempt to use the default port but if it is busy, we offer the user to
// run on a different port. `detect()` Promise resolves to the next free port.
choosePort(HOST, DEFAULT_PORT)
@@ -200,14 +199,13 @@ function startWebPackDevServer(pyServer){
if (err) {
return console.log(err);
}
// if (isInteractive) {
// clearConsole();
// }
const urls = prepareUrls(protocol, HOST, '5000');
pyServer();
openBrowser(urls.localUrlForBrowser);
if (isInteractive) {
clearConsole();
const urls = prepareUrls(protocol, HOST, '5000');
pyServer();
openBrowser(urls.localUrlForBrowser);
}
});
// openBrowser(urls.localUrlForBrowser);
})
.catch(err => {
if (err && err.message) {