mirror of https://github.com/embarklabs/embark.git
revs re: .embark/versions
This commit is contained in:
parent
d2a83e3930
commit
7cffe94059
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue