Skip to content

Commit

Permalink
Teach babel-preset-default where to lookup for dependencies
Browse files Browse the repository at this point in the history
Starts in own node_modules.
  • Loading branch information
oandregal committed Feb 28, 2019
1 parent 738fc86 commit 785c91c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/babel-preset-default/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ module.exports = function( api ) {

return {
presets: [
! isTestEnv && [ '@babel/preset-env', {
! isTestEnv && [ require.resolve( '@babel/preset-env' ), {
modules: false,
targets: {
browsers: [ 'extends @wordpress/browserslist-config' ],
browsers: require( '@wordpress/browserslist-config' ),
},
} ],
isTestEnv && [ '@babel/preset-env', {
isTestEnv && [ require.resolve( '@babel/preset-env' ), {
useBuiltIns: 'usage',
} ],
].filter( Boolean ),
plugins: [
'@babel/plugin-proposal-object-rest-spread',
require.resolve( '@babel/plugin-proposal-object-rest-spread' ),
[
'@wordpress/babel-plugin-import-jsx-pragma',
require.resolve( '@wordpress/babel-plugin-import-jsx-pragma' ),
{
scopeVariable: 'createElement',
source: '@wordpress/element',
isDefault: false,
},
],
[ '@babel/plugin-transform-react-jsx', {
[ require.resolve( '@babel/plugin-transform-react-jsx' ), {
pragma: 'createElement',
} ],
'@babel/plugin-proposal-async-generator-functions',
! isTestEnv && [ '@babel/plugin-transform-runtime', {
require.resolve( '@babel/plugin-proposal-async-generator-functions' ),
! isTestEnv && [ require.resolve( '@babel/plugin-transform-runtime' ), {
corejs: false, // We polyfill so we don't need core-js.
helpers: true,
regenerator: false, // We polyfill so we don't need regenerator.
Expand Down

0 comments on commit 785c91c

Please sign in to comment.