Created
August 25, 2021 13:35
-
-
Save PinkiNice/68e580bc032c915863c6dde4eaa5e2ca to your computer and use it in GitHub Desktop.
Babel with effector/babel-plugin config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (api) => { | |
const mode = process.env.NODE_ENV ?? 'production'; | |
// This caches the Babel config by environment. | |
api.cache.using(() => mode); | |
return { | |
presets: [ | |
[ | |
'@babel/preset-env', | |
{ | |
targets: { | |
browsers: ['>1%', 'last 4 versions', 'not ie < 9'], | |
}, | |
useBuiltIns: 'usage', | |
debug: false, | |
corejs: 3, | |
}, | |
], | |
'@babel/preset-react', | |
], | |
plugins: [ | |
'@babel/plugin-syntax-dynamic-import', | |
'@babel/plugin-proposal-class-properties', | |
'@babel/plugin-proposal-export-namespace-from', | |
'@babel/plugin-proposal-throw-expressions', | |
'@babel/proposal-object-rest-spread', | |
['effector/babel-plugin', {addLoc: true}], | |
[ | |
'effector/babel-plugin', | |
{ | |
factories: ['src/widget/lib/effector/createServerResource'], | |
}, | |
'factories', | |
], | |
'i18next-extract', | |
// 'effector-logger/babel-plugin', | |
// Applies the react-refresh Babel plugin on non-production modes only | |
mode !== 'production' && 'react-refresh/babel', | |
].filter(Boolean), | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment