single webpack run
This commit is contained in:
parent
e9ec968598
commit
f654c0a013
|
@ -85,7 +85,31 @@ class Pipeline {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
function runWebpack(next) {
|
||||||
|
self.logger.info(__('running webpack...'));
|
||||||
|
let built = false;
|
||||||
|
const webpackProcess = new ProcessLauncher({
|
||||||
|
modulePath: utils.joinPath(__dirname, 'webpackProcess.js'),
|
||||||
|
logger: self.logger,
|
||||||
|
events: self.events,
|
||||||
|
exitCallback: function (code) {
|
||||||
|
if (!built) {
|
||||||
|
return next(`Webpack build exited with code ${code} before the process finished`);
|
||||||
|
}
|
||||||
|
if (code) {
|
||||||
|
self.logger(__('Webpack build process exited with code ', code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
webpackProcess.send({action: constants.pipeline.init, options: {webpackConfigName: self.webpackConfigName}});
|
webpackProcess.send({action: constants.pipeline.init, options: {webpackConfigName: self.webpackConfigName}});
|
||||||
|
webpackProcess.send({action: constants.pipeline.build, assets: self.assetFiles, importsList});
|
||||||
|
|
||||||
|
webpackProcess.once('result', constants.pipeline.built, (msg) => {
|
||||||
|
built = true;
|
||||||
|
webpackProcess.kill();
|
||||||
|
return next(msg.error);
|
||||||
|
});
|
||||||
|
},
|
||||||
function assetFileWrite(next) {
|
function assetFileWrite(next) {
|
||||||
async.eachOf(self.assetFiles, function (files, targetFile, cb) {
|
async.eachOf(self.assetFiles, function (files, targetFile, cb) {
|
||||||
async.map(files,
|
async.map(files,
|
||||||
|
@ -101,31 +125,6 @@ class Pipeline {
|
||||||
|
|
||||||
// JS files
|
// JS files
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function runWebpack(next) {
|
|
||||||
let built = false;
|
|
||||||
const webpackProcess = new ProcessLauncher({
|
|
||||||
modulePath: utils.joinPath(__dirname, 'webpackProcess.js'),
|
|
||||||
logger: self.logger,
|
|
||||||
events: self.events,
|
|
||||||
exitCallback: function (code) {
|
|
||||||
if (!built) {
|
|
||||||
return next(`File building of ${file.filename} exited with code ${code} before the process finished`);
|
|
||||||
}
|
|
||||||
if (code) {
|
|
||||||
self.logger(__('File building process exited with code ', code));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
webpackProcess.send({action: constants.pipeline.init, options: {env: self.env}});
|
|
||||||
webpackProcess.send({action: constants.pipeline.build, file, importsList});
|
|
||||||
|
|
||||||
webpackProcess.once('result', constants.pipeline.built, (msg) => {
|
|
||||||
built = true;
|
|
||||||
webpackProcess.kill();
|
|
||||||
return next(msg.error);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
function readFile(next) {
|
function readFile(next) {
|
||||||
fs.readFile('./.embark/' + file.filename, (err, data) => {
|
fs.readFile('./.embark/' + file.filename, (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in New Issue