mirror of
https://github.com/gregberge/loadable-components.git
synced 2026-01-18 15:12:26 +00:00
* Add extensions to all imports * Output ESM and CJS for dual publish * Force extensions in ESLint * Bump babel/runtime
28 lines
551 B
JavaScript
28 lines
551 B
JavaScript
function getTargets() {
|
|
if (process.env.BUILD_TARGET === 'node') {
|
|
return { node: '8' }
|
|
}
|
|
return undefined
|
|
}
|
|
|
|
function getModules() {
|
|
if (process.env.MODULE_TARGET === 'cjs') {
|
|
return 'cjs'
|
|
}
|
|
if (process.env.MODULE_TARGET === 'esm') {
|
|
return false
|
|
}
|
|
return 'auto'
|
|
}
|
|
|
|
module.exports = {
|
|
presets: [
|
|
['@babel/preset-react', { useBuiltIns: true }],
|
|
[
|
|
'@babel/preset-env',
|
|
{ loose: true, targets: getTargets(), modules: getModules() },
|
|
],
|
|
],
|
|
plugins: ['@babel/plugin-proposal-class-properties'],
|
|
}
|