Revert "Merge pull request #663 from embark-framework/revert-656-bug_fix/dot.embark_versions_modules"

This reverts commit 7859c384ca1a9a4a307a53ea2b477c0d78766ca9, reversing
changes made to a58f21c30340e74c3cd8b35b4545a6760c9d9909.
This commit is contained in:
Michael Bradley, Jr 2018-07-30 16:26:25 -05:00 committed by Iuri Matias
parent bfd4d43c00
commit d68fe61606

View File

@ -6,6 +6,7 @@ const constants = require('../constants');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const ProcessWrapper = require('../core/processes/processWrapper');
const path = require('path');
const glob = require('glob');
let webpackProcess;
@ -87,22 +88,9 @@ class WebpackProcess extends ProcessWrapper {
[{test: /app[\\/]|contracts[\\/]/}]
)
]
},
plugins: [
new HardSourceWebpackPlugin({
cacheDirectory: fs.dappPath('node_modules/.cache/hard-source'),
// ufglify (wp mode: production) will still save its cache in embark's node_modules/.cache/
environmentHash: {
root: fs.dappPath()
}
}),
new HardSourceWebpackPlugin.ExcludeModulePlugin(
[{test: /app[\\/]|contracts[\\/]/}]
)
]
};
};
let webpackOptions = utils.recursiveMerge(defaultOptions, options);
let webpackOptions = utils.recursiveMerge(defaultOptions, options);
if (includeModules) {
webpackOptions.module = {
@ -154,57 +142,57 @@ class WebpackProcess extends ProcessWrapper {
compact: false
}
}
}
]
};
]
};
let dappBabelrc = path.join(realCwd, '.babelrc');
if (fs.existsSync(dappBabelrc)) {
webpackOptions.module.rules[3].options.extends = dappBabelrc;
let dappBabelrc = path.join(realCwd, '.babelrc');
if (fs.existsSync(dappBabelrc)) {
webpackOptions.module.rules[3].options.extends = dappBabelrc;
}
}
}
webpack(webpackOptions).run((err, stats) => {
async.waterfall([
function checkStatsError(next) {
if (err) {
console.error(err);
return next(err);
}
if (!detectErrors) {
return next();
}
if (stats.hasErrors()) {
return next(
stats.toJson(webpackOptions.stats).errors.join("\n")
);
}
next();
}//,
// function writeStatsReport(next) {
// if (detectErrors) {
// self._log('info', 'writing file '+ ('.embark/stats.report').bold.dim);
// }
// fs.writeFile(
// path.join(fs.dappPath('.embark'), 'stats.report'),
// stats.toString(webpackOptions.stats),
// next
// );
// },
// function writeStatsJSON(next) {
// if (detectErrors) {
// self._log('info','writing file '+ ('.embark/stats.json').bold.dim);
// }
// fs.writeFile(
// path.join(fs.dappPath('.embark'), 'stats.json'),
// JSON.stringify(stats.toJson(webpackOptions.stats)),
// next
// );
// }
// note: to visualize the stats info in a browser, do...
// `npx webpack-bundle-analyzer <dapp_dir>/.embark/stats.json`
], (err) => {
callback(err);
webpack(webpackOptions).run((err, stats) => {
async.waterfall([
function checkStatsError(next) {
if (err) {
console.error(err);
return next(err);
}
if (!detectErrors) {
return next();
}
if (stats.hasErrors()) {
return next(
stats.toJson(webpackOptions.stats).errors.join("\n")
);
}
next();
}//,
// function writeStatsReport(next) {
// if (detectErrors) {
// self._log('info', 'writing file '+ ('.embark/stats.report').bold.dim);
// }
// fs.writeFile(
// path.join(fs.dappPath('.embark'), 'stats.report'),
// stats.toString(webpackOptions.stats),
// next
// );
// },
// function writeStatsJSON(next) {
// if (detectErrors) {
// self._log('info','writing file '+ ('.embark/stats.json').bold.dim);
// }
// fs.writeFile(
// path.join(fs.dappPath('.embark'), 'stats.json'),
// JSON.stringify(stats.toJson(webpackOptions.stats)),
// next
// );
// }
// note: to visualize the stats info in a browser, do...
// `npx webpack-bundle-analyzer <dapp_dir>/.embark/stats.json`
], (err) => {
callback(err);
});
});
});
}