Skip to content

Commit

Permalink
feat(babel-preset-kitt-universal): disable styled-components plugins …
Browse files Browse the repository at this point in the history
…by default
  • Loading branch information
christophehurpeau committed Sep 13, 2023
1 parent 1c7495f commit 36cd8b4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions @ornikar/babel-preset-kitt-universal/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ const checkIsWebOption = (opts) => {

module.exports = function preset(context, opts = {}) {
checkIsWebOption(opts);
const { isWeb, styledComponentsOptions, enableStyledComponentsReactNativeImport, disableLinaria = !isWeb } = opts;
const {
isWeb,
styledComponentsOptions,
enableStyledComponentsReactNativeImport,
disableLinaria = !isWeb,
enableLegacyStyledComponents = false,
} = opts;

return {
plugins: [
disableLinaria && 'babel-plugin-linaria-css-to-undefined',
[
enableLegacyStyledComponents && [
'babel-plugin-styled-components',
{
ssr: isWeb,
Expand All @@ -26,7 +32,9 @@ module.exports = function preset(context, opts = {}) {
...styledComponentsOptions,
},
],
enableStyledComponentsReactNativeImport && 'babel-plugin-styled-components-react-native-web',
enableLegacyStyledComponents &&
enableStyledComponentsReactNativeImport &&
'babel-plugin-styled-components-react-native-web',
isWeb && ['babel-plugin-react-native', { OS: 'web' }],
].filter(Boolean),
};
Expand Down

0 comments on commit 36cd8b4

Please sign in to comment.