From d68fe61606cba37b31b44afb5d57d208606ed21e Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Mon, 30 Jul 2018 16:26:25 -0500 Subject: [PATCH] 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. --- lib/pipeline/webpackProcess.js | 114 +++++++++++++++------------------ 1 file changed, 51 insertions(+), 63 deletions(-) diff --git a/lib/pipeline/webpackProcess.js b/lib/pipeline/webpackProcess.js index 30c7ddc2..57390e1a 100644 --- a/lib/pipeline/webpackProcess.js +++ b/lib/pipeline/webpackProcess.js @@ -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 /.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 /.embark/stats.json` + ], (err) => { + callback(err); + }); }); }); }