From 7123d2730a34deafec9dee69e596e25db3f2e1f0 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Fri, 17 Aug 2018 12:34:20 -0500 Subject: [PATCH] rev webpack cfg such that when embark is global the cfg works from w/in a dapp (ejected) or w/in embark (default) --- webpack.config.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 1386eb2c5..596326c01 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -25,6 +25,8 @@ const HardSourceWebpackPlugin = require('hard-source-webpack-plugin'); const path = require('path'); const dappPath = process.env.DAPP_PATH; +const embarkPath = process.env.EMBARK_PATH; + const embarkAliases = require(path.join(dappPath, '.embark/embark-aliases.json')); const embarkAssets = require(path.join(dappPath, '.embark/embark-assets.json')); @@ -84,12 +86,12 @@ const base = { options: { plugins: [ [ - 'module-resolver', { + require.resolve('babel-plugin-module-resolver'), { 'alias': embarkAliases } ], [ - '@babel/plugin-transform-runtime', { + require.resolve('@babel/plugin-transform-runtime'), { corejs: 2, useESModules: true } @@ -97,14 +99,14 @@ const base = { ], presets: [ [ - '@babel/preset-env', { + require.resolve('@babel/preset-env'), { modules: false, targets: { browsers: ['last 1 version', 'not dead', '> 0.2%'] } } ], - '@babel/preset-react' + require.resolve('@babel/preset-react') ] } } @@ -131,8 +133,15 @@ const base = { alias: embarkAliases, modules: [ ...versions, - 'node_modules' + 'node_modules', + path.join(embarkPath, 'node_modules') ] + }, + resolveLoader: { + modules: [ + 'node_modules', + path.join(embarkPath, 'node_modules') + ], } };