Skip to content

After adding @emotion/babel-preset-css-prop to babel plugins tests won't work #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
openscript opened this issue May 25, 2021 · 2 comments

Comments

@openscript
Copy link

I've the following craco.config.js:

const CracoAntDesignPlugin = require("craco-antd");
const CracoLessPlugin = require("craco-less");

const emotionBabelPreset = require("@emotion/babel-preset-css-prop").default(
  undefined,
  {} // emotion preset options
);

module.exports = {
  plugins: [{ plugin: CracoAntDesignPlugin }, { plugin: CracoLessPlugin }],
  babel: {
    plugins: [
      ...emotionBabelPreset.plugins
    ]
  }
};

When I run my tests they fail with:

    .plugins[0][0] must be a string, object, function

      at assertPluginTarget (node_modules/babel-jest/node_modules/@babel/core/lib/config/validation/option-assertions.js:264:11)
          at Array.forEach (<anonymous>)
          at Array.forEach (<anonymous>)

When I remove ...emotionBabelPreset.plugins it works. I'm on the most recent Craco and CRA version. Does anybody has an idea what is going on here?

@emanual4real
Copy link

Same issue, works if I remove the babel-preset-css-prop plugin.

/* eslint-disable import/no-extraneous-dependencies */
const emotionBabelPreset = require('@emotion/babel-preset-css-prop').default(
  undefined,
  {},
);

module.exports = {
  babel: {
    plugins: [...emotionBabelPreset.plugins],
  },
};

@stale
Copy link

stale bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 8, 2022
@stale stale bot closed this as completed Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants