mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-09 13:36:14 +00:00
rev webpack config w.r.t. webpack 4, babel 7
This commit is contained in:
parent
5f7fd7107f
commit
5a5fe476e2
@ -36,13 +36,20 @@ class WebpackProcess extends ProcessWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
webpackRun(filename, options, includeModules, importsList, detectErrors, realCwd, callback) {
|
webpackRun(filename, options, includeModules, importsList, detectErrors, realCwd, callback) {
|
||||||
|
const self = this;
|
||||||
let defaultOptions = {
|
let defaultOptions = {
|
||||||
|
mode: self.env === 'development' ? 'none' : 'production',
|
||||||
entry: fs.dappPath(filename),
|
entry: fs.dappPath(filename),
|
||||||
output: {
|
output: {
|
||||||
|
globalObject: 'typeof self !== \'undefined\' ? self : this',
|
||||||
|
libraryExport: 'default',
|
||||||
libraryTarget: 'umd',
|
libraryTarget: 'umd',
|
||||||
path: fs.dappPath('.embark'),
|
path: fs.dappPath('.embark'),
|
||||||
filename: filename
|
filename: filename,
|
||||||
|
umdNamedDefine: true
|
||||||
},
|
},
|
||||||
|
profile: true,
|
||||||
|
stats: 'verbose',
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: importsList,
|
alias: importsList,
|
||||||
modules: [
|
modules: [
|
||||||
@ -86,17 +93,40 @@ class WebpackProcess extends ProcessWrapper {
|
|||||||
loader: "babel-loader",
|
loader: "babel-loader",
|
||||||
exclude: /(node_modules|bower_components)/,
|
exclude: /(node_modules|bower_components)/,
|
||||||
options: {
|
options: {
|
||||||
extends: path.join(realCwd, '.babelrc'),
|
presets: [
|
||||||
presets: ['babel-preset-es2016', 'babel-preset-es2017', 'babel-preset-react'].map(require.resolve),
|
[
|
||||||
plugins: ["babel-plugin-webpack-aliases"].map(require.resolve),
|
"@babel/preset-env", {
|
||||||
|
modules: false,
|
||||||
|
targets: {
|
||||||
|
browsers: ["last 1 version", "not dead", "> 0.2%"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@babel/preset-react"
|
||||||
|
].map(pkg => {
|
||||||
|
if (Array.isArray(pkg)) {
|
||||||
|
let _pkg = pkg[0];
|
||||||
|
pkg[0] = require.resolve(_pkg);
|
||||||
|
return pkg;
|
||||||
|
} else {
|
||||||
|
return require.resolve(pkg);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
plugins: [
|
||||||
|
"@babel/plugin-transform-runtime",
|
||||||
|
"babel-plugin-webpack-aliases"
|
||||||
|
].map(require.resolve),
|
||||||
compact: false
|
compact: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
let dappBabelrc = path.join(realCwd, '.babelrc');
|
||||||
|
if (fs.existsSync(dappBabelrc)) {
|
||||||
|
webpackOptions.module.rules[3].options.extends = dappBabelrc;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
webpack(webpackOptions).run((err, stats) => {
|
webpack(webpackOptions).run((err, stats) => {
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user