DouyinFE / semi-design

🚀A modern, comprehensive, flexible design system and React UI library. 🎨 Provide more than 3000+ Design Tokens, easy to build your design system. Make Semi Design to Any Design. 🧑🏻‍💻 Design to Code in one click
https://semi.design
Other
8.29k stars 699 forks source link

Nextjs+Tailwind搭配使用的最佳实践启动报错 #2404

Open xggz opened 1 month ago

xggz commented 1 month ago

Is there an existing issue for this?

Which Component

SemiWebpackPlugin

Semi Version

2.63.1

Current Behavior

我使用的Nextjs14,然后集成了semi、tailwind,看文档https://semi.design/zh-CN/start/tailwind的步骤开启@douyinfe/semi-webpack-plugin插件,然后next dev报错: TypeError: SemiWebpackPlugin is not a constructor

Expected Behavior

No response

Steps To Reproduce

No response

ReproducibleCode

import SemiWebpackPlugin from "@douyinfe/semi-webpack-plugin";

/** @type {import('next').NextConfig} */
const nextConfig = {
    transpilePackages: ['@douyinfe/semi-ui', '@douyinfe/semi-icons', '@douyinfe/semi-illustrations'],
    swcMinify: true,
    // fastRefresh: true,
    // concurrentFeatures: true,
    webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
        config.plugins.push(new SemiWebpackPlugin({
            cssLayer: true
        }));
        return config
    },
};

export default nextConfig;

Environment

- OS: macos
- browser:

Anything else?

No response

pointhalo commented 4 weeks ago

Next有自己特殊工程化构建体系。不适用普通webpack插件。 我们目前提供的 layer能力只覆盖普通 webpack 、rspack 项目。

xggz commented 4 weeks ago

Next有自己特殊工程化构建体系。不适用普通webpack插件。 我们目前提供的 layer能力只覆盖普通 webpack 、rspack 项目。

不用SemiWebpackPlugin插件的话,大佬有其它临时解决方案吗,现在给semi组件加tailwind的className不生效,会被semi组件的样式覆盖掉。

pointhalo commented 3 weeks ago

你去掉 tailwind自己的 prelight就行