Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit 260ccbc

Browse files
committed
fix(webpack5-react): update tailwind config
1 parent 89361b0 commit 260ccbc

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

‎packages/plugin-webpack5-react/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alicloud/console-toolkit-plugin-webpack5-react",
3-
"version": "1.4.2",
3+
"version": "1.4.3",
44
"description": "console toolkit plugin for base react app",
55
"main": "lib/index.js",
66
"scripts": {
@@ -64,6 +64,7 @@
6464
"semver": "^7.3.2",
6565
"simple-progress-webpack-plugin": "^1.1.2",
6666
"style-loader": "^3.0.0",
67+
"tailwindcss": "^3.4.4",
6768
"terser-webpack-plugin": "^5.3.6",
6869
"thread-loader": "^3.0.0",
6970
"url-loader": "^4.1.0",

‎packages/plugin-webpack5-react/src/types/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ interface BreezrReactOptions {
3636
postCssPlugins?: any[];
3737
disableImportXConsoleCSS?: boolean;
3838
useSass?: boolean;
39+
tailwindcss?: any;
3940

4041
// babel-loader 配置
4142
babel?: Function;
@@ -163,6 +164,9 @@ interface BreezrStyleOptions extends Pick<BreezrReactOptions, 'appId' | 'console
163164
condition?: CssConditionType;
164165
postCssPlugins?: any[];
165166
useSass?: boolean;
167+
tailwindcss?: {
168+
config?: string;
169+
};
166170
}
167171

168172
interface ThemeDef {

‎packages/plugin-webpack5-react/src/webpack/common.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export const common = (config: Chain, options: BreezrReactOptions = defaultOptio
9292
appId,
9393
mf,
9494
useSass,
95+
tailwindcss,
9596
} = options;
9697

9798
if (!cwd) {
@@ -178,7 +179,8 @@ export const common = (config: Chain, options: BreezrReactOptions = defaultOptio
178179
consoleOS,
179180
disableConsoleOS,
180181
appId,
181-
useSass
182+
useSass,
183+
tailwindcss,
182184
});
183185

184186
file(config, options);

‎packages/plugin-webpack5-react/src/webpack/rules/style/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as path from 'path';
22
import * as autoprefixer from 'autoprefixer';
3+
import * as tailwindcss from 'tailwindcss';
34
import * as Chain from '@gem-mine/webpack-chain';
45
import * as webpack from 'webpack';
56

@@ -19,6 +20,7 @@ function applyCssLoaders(rule: Chain.Rule, options: BreezrStyleOptions) {
1920
hashPrefix = '',
2021
disableAutoPrefixer = false,
2122
postCssPlugins = [],
23+
tailwindcss: tailwindcssConfig = {},
2224
} = options;
2325

2426
// extract-text-webpack-plugin 在 webpack 4 中用作提取 css 的时候存在问题
@@ -80,6 +82,13 @@ function applyCssLoaders(rule: Chain.Rule, options: BreezrStyleOptions) {
8082
}))
8183
}
8284

85+
// add tailwindcss plugin
86+
if (tailwindcssConfig.config) {
87+
postCssPlugins.unshift(tailwindcss({
88+
config: tailwindcssConfig.config,
89+
}));
90+
}
91+
8392
rule
8493
.use('postcss-loader')
8594
.loader(require.resolve('postcss-loader'))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /