babel configured to extend dapp's .babelrc

This commit is contained in:
Michael Bradley, Jr 2018-07-17 22:26:56 -05:00 committed by Iuri Matias
parent f81c16e3aa
commit a3492f8dc8
1 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@ const fs = require('../core/fs');
const constants = require('../constants'); const constants = require('../constants');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin'); const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const ProcessWrapper = require('../process/processWrapper'); const ProcessWrapper = require('../process/processWrapper');
const path = require('path');
let webpackProcess; let webpackProcess;
@ -15,7 +16,7 @@ class WebpackProcess extends ProcessWrapper {
async.waterfall([ async.waterfall([
function findImports(next) { function findImports(next) {
self.webpackRun(file.filename, {}, false, importsList, false, next); self.webpackRun(file.filename, {}, false, importsList, false, realCwd, next);
}, },
function changeCwd(next) { function changeCwd(next) {
@ -25,7 +26,7 @@ class WebpackProcess extends ProcessWrapper {
}, },
function runWebpack(next) { function runWebpack(next) {
self.webpackRun(file.filename, {}, true, importsList, true, next); self.webpackRun(file.filename, {}, true, importsList, true, realCwd, next);
}, },
function changeCwdBack(next) { function changeCwdBack(next) {
@ -39,7 +40,7 @@ class WebpackProcess extends ProcessWrapper {
} }
webpackRun(filename, options, includeModules, importsList, detectErrors, callback) { webpackRun(filename, options, includeModules, importsList, detectErrors, realCwd, callback) {
let defaultOptions = { let defaultOptions = {
entry: fs.dappPath(filename), entry: fs.dappPath(filename),
output: { output: {
@ -82,6 +83,7 @@ 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: ['babel-preset-es2016', 'babel-preset-es2017', 'babel-preset-react'].map(require.resolve), presets: ['babel-preset-es2016', 'babel-preset-es2017', 'babel-preset-react'].map(require.resolve),
plugins: ["babel-plugin-webpack-aliases"].map(require.resolve), plugins: ["babel-plugin-webpack-aliases"].map(require.resolve),
compact: false compact: false