revs re: .embark/versions

This commit is contained in:
Michael Bradley, Jr 2018-07-29 20:52:44 -05:00
parent 5ad42c0697
commit 92a8fb7596
1 changed files with 142 additions and 131 deletions

View File

@ -6,6 +6,7 @@ const constants = require('../constants');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const ProcessWrapper = require('../processes/processWrapper');
const path = require('path');
const glob = require('glob');
let webpackProcess;
@ -42,6 +43,14 @@ class WebpackProcess extends ProcessWrapper {
webpackRun(filename, options, includeModules, importsList, detectErrors, realCwd, callback) {
const self = this;
glob(fs.dappPath('.embark/versions') + '/*/*', (err, files) => {
let versions;
if (err) {
console.error(err);
versions = [];
} else {
versions = files;
}
let defaultOptions = {
mode: self.env === 'production' ? 'production' : 'none',
// devtool: self.env === 'development' ? 'source-map' : false,
@ -62,8 +71,9 @@ class WebpackProcess extends ProcessWrapper {
resolve: {
alias: importsList,
modules: [
fs.embarkPath('node_modules'),
fs.dappPath('node_modules')
fs.dappPath('node_modules'),
...versions,
fs.embarkPath('node_modules')
]
},
plugins: [
@ -100,7 +110,7 @@ class WebpackProcess extends ProcessWrapper {
{
test: /\.js$/,
loader: "babel-loader",
exclude: /(node_modules|bower_components)/,
exclude: /(node_modules|bower_components|\.embark\/versions)/,
options: {
presets: [
[
@ -122,8 +132,8 @@ class WebpackProcess extends ProcessWrapper {
}
}),
plugins: [
"@babel/plugin-transform-runtime",
"babel-plugin-webpack-aliases"
"babel-plugin-webpack-aliases",
"@babel/plugin-transform-runtime"
].map(require.resolve),
compact: false
}
@ -180,6 +190,7 @@ class WebpackProcess extends ProcessWrapper {
callback(err);
});
});
});
}
}