forked from TobitSoftware/chayns-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babelPreset.js
27 lines (26 loc) · 825 Bytes
/
babelPreset.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module.exports = (api, options) => {
const { cjs = false, cssImports } = options;
return {
presets: [
['@babel/env', { modules: cjs ? 'cjs' : false, loose: true }],
'@babel/react',
],
plugins: [
'@babel/transform-runtime',
'optimize-clsx',
'dev-expression',
['@babel/proposal-class-properties', { loose: true }],
cssImports === 'remove' && [
'transform-remove-imports',
{ test: '\\.(scss|css)$' },
],
cssImports === 'rename' && [
'transform-rename-import',
{
original: '^(.+)\\.scss$',
replacement: '$1.css',
},
],
].filter(Boolean),
};
};