Skip to content

在 react 项目开发时,常常会使用这两个库,这两个库在一起工作时,在默认情况下会导致样式冲突的问题。

为了解决此问题,我们需要在 tailwind.config.js 中进行如下配置:

diff
/** @type {import('tailwindcss').Config} */
export default {
  content: ["./src/**/*.{js,ts,jsx,tsx}", "./src/*.{js,ts,jsx,tsx}"],
  theme: {
    extend: {},
  },
+  corePlugins: {
+    preflight: false,
+  },
  plugins: [],
};
/** @type {import('tailwindcss').Config} */
export default {
  content: ["./src/**/*.{js,ts,jsx,tsx}", "./src/*.{js,ts,jsx,tsx}"],
  theme: {
    extend: {},
  },
+  corePlugins: {
+    preflight: false,
+  },
  plugins: [],
};