← All tasks
javascriptdcastil/tailwind-merge #28Not a task: not reproduced

Issue with type `module` exports in Next js

envgap__dcastil__tailwind-merge-28

01 / FAILURE SIGNATURE

As reported upstream

(error can be seen here)
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
017f9d0140875450a0fe25984aee04929e8ef66c
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

dcastil/tailwind-merge #28 · read the original issue
First of all, there seems to be no issue when using `tailwind-merge` directly inside a Next.js project.

Example: https://stackblitz.com/edit/nextjs-wxchtk?file=pages%2Findex.js



Issue for me is when I bundle `tailwind-merge` along with my UI library & try to start Next.js.

Example: https://stackblitz.com/edit/next-tailwind-jit-evzkdg?file=components%2Findex.js

(error can be seen here)



My `babel.config.js` to bundle my components with `tailwind-merge`



```js

const BABEL_ENV = process.env.BABEL_ENV;

const isCommonJS = BABEL_ENV !== undefined && BABEL_ENV === "cjs";

const isESM = BABEL_ENV !== undefined && BABEL_ENV === "esm";

const isBuild = !!BABEL_ENV;



module.exports = function (api) {

  api.cache(true);



  const presets = [

    [

      "@babel/env",

      {

        modules: isCommonJS ? "commonjs" : false,

        targets: { esmodules: isESM ? true : undefined },

      },

    ],

    ["@babel/preset-react", { runtime: "automatic" }],

    "@babel/preset-typescript",

  ];



  const plugins = [

    ["@babel/plugin-proposal-class-properties", { loose: true }],

    ["@babel/plugin-proposal-logical-assignment-operators", { loose: true }],

    ["@babel/plugin-proposal-private-property-in-object", { loose: true }],

    ["@babel/plugin-proposal-private-methods", { loose: true }],

    ["lodash"],

    isBuild

      ? [

          "babel-plugin-jsx-remove-data-test-id",

          { attributes: ["data-testid"] },

        ]

      : {},

  ];



  return {

    presets,

    plugins,

    env: {

      test: {

        presets: [["@babel/env", { targets: { node: "current" } }]],

      },

    },

    ignore: isBuild

      ? [

          "**/*/stories",

          "**/__tests__",

          "**/testUtils.tsx",

          "./renderlesskit.config.ts",

        ]

      : [],

  };

};

```



![image](https://user-images.githubusercontent.com/39694575/137110566-21c5dbcb-8d44-4686-998a-38e92753166d.png)

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]