Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
transform: (importName, matches) => {
if (!matches || !matches[1] || matches[1] === '@instructure/ui-test-utils') return
return `${matches[1]}/lib/${importName}`
}
}
}
])
}
// Work around https://github.com/babel/babel/issues/10261, which causes
// Babel to not use the runtime helpers for things like _objectSpread.
// Remove this once that babel issue is fixed
let babelHelperVersion = {}
try {
// eslint-disable-next-line import/no-extraneous-dependencies
const version = require('@babel/helpers/package.json').version
babelHelperVersion.version = version
} catch (e) {
// if something goes wrong, continue and don't try to explicitly set a helper version
}
plugins = plugins.concat([
require('babel-plugin-macros'),
require('@babel/plugin-transform-destructuring').default,
[require('@babel/plugin-proposal-decorators').default, { legacy: true }], // must run before themeable-styles plugin below
[require('@babel/plugin-proposal-class-properties').default, { loose: true }],
require('@babel/plugin-proposal-export-default-from').default,
[require('@babel/plugin-proposal-object-rest-spread').default, { useBuiltIns: true }],
require('@babel/plugin-proposal-optional-chaining').default,
[require('@babel/plugin-transform-runtime').default, {
...babelHelperVersion,
corejs: false,
plugins: [
require.resolve( '@babel/plugin-proposal-class-properties' ),
require.resolve( '@babel/plugin-proposal-nullish-coalescing-operator' ),
require.resolve( '@babel/plugin-proposal-optional-chaining' ),
require.resolve( '@babel/plugin-syntax-dynamic-import' ),
[
require.resolve( '@babel/plugin-transform-runtime' ),
{
corejs: false, // we polyfill so we don't need core-js
helpers: true,
regenerator: false,
useESModules: false,
// Needed so that helpers aren't duplicated.
// This will need to be kept up to date while https://github.com/babel/babel/issues/10261 is unresolved.
// eslint-disable-next-line import/no-extraneous-dependencies
version: require( '@babel/helpers/package.json' ).version,
},
],
],
} );