diff --git a/lib/pipeline/webpack.config.js b/lib/pipeline/webpack.config.js index f024c466..4096b0c2 100644 --- a/lib/pipeline/webpack.config.js +++ b/lib/pipeline/webpack.config.js @@ -63,6 +63,16 @@ const entry = Object.keys(embarkAssets) return obj; }, {}); +function resolve(pkgName) { + if (Array.isArray(pkgName)) { + const _pkgName = pkgName[0]; + pkgName[0] = require.resolve(_pkgName); + return pkgName; + } else { + return require.resolve(pkgName); + } +} + // base config // ----------------------------------------------------------------------------- @@ -90,28 +100,28 @@ const base = { options: { plugins: [ [ - require.resolve('babel-plugin-module-resolver'), { + 'babel-plugin-module-resolver', { 'alias': embarkAliases } ], [ - require.resolve('@babel/plugin-transform-runtime'), { + '@babel/plugin-transform-runtime', { corejs: 2, useESModules: true } ] - ], + ].map(resolve), presets: [ [ - require.resolve('@babel/preset-env'), { + '@babel/preset-env', { modules: false, targets: { browsers: ['last 1 version', 'not dead', '> 0.2%'] } } ], - require.resolve('@babel/preset-react') - ] + '@babel/preset-react' + ].map(resolve) } } ]