bradlc / babel-plugin-tailwind-components

Use Tailwind with any CSS-in-JS library
MIT License
332 stars 25 forks source link

ReferenceError: _tailwindUtils is not defined #40

Open phmngocnghia opened 5 years ago

phmngocnghia commented 5 years ago
ReferenceError: _tailwindUtils is not defined
    at Module.eval (VM976 App.tsx:40)
    at eval (VM976 App.tsx:161)
    at Module../src/components/App/App.tsx (main.9f787f00b42515ca1d63.hot-update.js:11)
    at __webpack_require__ (main.9f787f00b42515ca1d63.js:727)
    at hotApply (main.9f787f00b42515ca1d63.js:660)
    at main.9f787f00b42515ca1d63.js:314

Error is shown when added tailwind macro to responsive media query select:

const demo = css`
  @media screen and (min-width: 376px) {
    ${tw("text-green")}
  }
`;

Reproduce:

Babel configs:

{
  "presets": [
    [
      "@babel/typescript",
      {
        "allExtensions": true,
        "isTSX": true
      }
    ],
    [
      "@babel/preset-env",
      {
        "targets": {
          "esmodules": true
        }
      }
    ],
    "@babel/react",
    "@emotion/babel-preset-css-prop"
  ],
  "plugins": [
    "emotion",
    "tailwind-components",
    "macros",
    "@babel/plugin-transform-runtime",
    "react-hot-loader/babel"
  ],
  "ignore": [
    "./scripts/codegen/recursiveGenerateExportFile/__test__"
  ]
}