create-weapp-vite 2.3.4 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +5 -3
  2. package/dist/cli.js +36 -31
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +1 -1
  5. package/dist/{src-2teZ_6MA.js → src-Tx4viskG.js} +20 -8
  6. package/package.json +1 -1
  7. package/templates/default/eslint.config.js +1 -1
  8. package/templates/default/package.json +1 -0
  9. package/templates/default/src/app.scss +1 -0
  10. package/templates/default/src/components/HelloWorld/HelloWorld.scss +10 -10
  11. package/templates/default/src/pages/index/index.scss +1 -0
  12. package/templates/lib/eslint.config.js +1 -1
  13. package/templates/lib/package.json +2 -1
  14. package/templates/lib/src/app.scss +1 -0
  15. package/templates/lib/src/components/HelloWorld/HelloWorld.scss +10 -10
  16. package/templates/lib/src/components/sfc-setup/index.vue +8 -8
  17. package/templates/plugin/.editorconfig +9 -0
  18. package/templates/plugin/README.md +35 -0
  19. package/templates/plugin/eslint.config.js +6 -0
  20. package/templates/plugin/gitignore +36 -0
  21. package/templates/plugin/package.json +45 -0
  22. package/templates/plugin/plugin/components/hello-component/index.vue +174 -0
  23. package/templates/plugin/plugin/components/native-meter/index.json +6 -0
  24. package/templates/plugin/plugin/components/native-meter/index.scss +51 -0
  25. package/templates/plugin/plugin/components/native-meter/index.ts +28 -0
  26. package/templates/plugin/plugin/components/native-meter/index.wxml +12 -0
  27. package/templates/plugin/plugin/index.ts +16 -0
  28. package/templates/plugin/plugin/pages/hello-page/index.vue +332 -0
  29. package/templates/plugin/plugin/pages/native-playground/index.json +7 -0
  30. package/templates/plugin/plugin/pages/native-playground/index.scss +81 -0
  31. package/templates/plugin/plugin/pages/native-playground/index.ts +20 -0
  32. package/templates/plugin/plugin/pages/native-playground/index.wxml +30 -0
  33. package/templates/plugin/plugin/plugin.json +11 -0
  34. package/templates/plugin/plugin/utils/showcase.ts +102 -0
  35. package/templates/plugin/project.config.json +48 -0
  36. package/templates/plugin/project.private.config.json +8 -0
  37. package/templates/plugin/shared/shared-data.ts +12 -0
  38. package/templates/plugin/src/app.json +11 -0
  39. package/templates/plugin/src/app.ts +5 -0
  40. package/templates/plugin/src/pages/index/index.json +6 -0
  41. package/templates/plugin/src/pages/index/index.ts +46 -0
  42. package/templates/plugin/src/pages/index/index.wxml +46 -0
  43. package/templates/plugin/src/pages/index/index.wxss +113 -0
  44. package/templates/plugin/src/sitemap.json +7 -0
  45. package/templates/plugin/stylelint.config.js +5 -0
  46. package/templates/plugin/tsconfig.json +17 -0
  47. package/templates/plugin/weapp-vite.config.ts +23 -0
  48. package/templates/tailwindcss/eslint.config.js +4 -1
  49. package/templates/tailwindcss/package.json +3 -2
  50. package/templates/tailwindcss/postcss.config.js +1 -2
  51. package/templates/tailwindcss/src/app.css +2 -0
  52. package/templates/tailwindcss/src/pages/index/index.scss +1 -0
  53. package/templates/tailwindcss/src/pages/profile/index.scss +1 -0
  54. package/templates/tailwindcss/tailwind.config.ts +0 -5
  55. package/templates/tailwindcss/weapp-vite.config.ts +2 -0
  56. package/templates/tdesign/eslint.config.js +4 -1
  57. package/templates/tdesign/package.json +3 -2
  58. package/templates/tdesign/postcss.config.js +1 -2
  59. package/templates/tdesign/src/app.css +2 -0
  60. package/templates/tdesign/src/pages/index/index.scss +1 -0
  61. package/templates/tdesign/tailwind.config.ts +0 -5
  62. package/templates/tdesign/weapp-vite.config.ts +2 -0
  63. package/templates/vant/eslint.config.js +4 -1
  64. package/templates/vant/package.json +3 -2
  65. package/templates/vant/postcss.config.js +1 -2
  66. package/templates/vant/src/app.css +2 -0
  67. package/templates/vant/src/pages/index/index.scss +1 -0
  68. package/templates/vant/tailwind.config.ts +0 -5
  69. package/templates/vant/weapp-vite.config.ts +2 -0
  70. package/templates/wevu/eslint.config.js +1 -1
  71. package/templates/wevu/package.json +1 -0
  72. package/templates/wevu-tdesign/eslint.config.js +13 -1
  73. package/templates/wevu-tdesign/package.json +3 -2
  74. package/templates/wevu-tdesign/postcss.config.js +1 -2
  75. package/templates/wevu-tdesign/src/app.css +7 -0
  76. package/templates/wevu-tdesign/src/app.vue +1 -10
  77. package/templates/wevu-tdesign/tailwind.config.ts +0 -5
  78. package/templates/wevu-tdesign/weapp-vite.config.ts +1 -0
  79. package/templates/tailwindcss/src/app.scss +0 -3
  80. package/templates/tdesign/src/app.scss +0 -3
  81. package/templates/vant/src/app.scss +0 -3
@@ -0,0 +1,20 @@
1
+ import { getFeatureCards, getPluginShowcaseSummary, getScoreTone } from '../../utils/showcase'
2
+
3
+ Page({
4
+ data: {
5
+ cards: getFeatureCards(),
6
+ currentCard: getFeatureCards()[0],
7
+ currentIndex: 0,
8
+ meterTone: 'success',
9
+ pluginSummary: getPluginShowcaseSummary(),
10
+ },
11
+ nextCard() {
12
+ const nextIndex = (this.data.currentIndex + 1) % this.data.cards.length
13
+ const currentCard = this.data.cards[nextIndex]
14
+ this.setData({
15
+ currentCard,
16
+ currentIndex: nextIndex,
17
+ meterTone: getScoreTone(currentCard.score),
18
+ })
19
+ },
20
+ })
@@ -0,0 +1,30 @@
1
+ <view class="page">
2
+ <view class="hero">
3
+ <text class="hero__eyebrow">plugin native page</text>
4
+ <text class="hero__title">原生 `Page` 继续可用</text>
5
+ <text class="hero__desc">
6
+ 这个页面保持原生小程序组织方式,但同样可以 import 插件内部的 TS 数据模块,并挂载 Vue SFC 组件。
7
+ </text>
8
+ </view>
9
+
10
+ <view class="panel">
11
+ <text class="panel__title">当前聚焦能力</text>
12
+ <text class="panel__line">{{ currentCard.title }}</text>
13
+ <text class="panel__line">{{ currentCard.summary }}</text>
14
+ <text class="panel__line">{{ pluginSummary }}</text>
15
+ <native-meter
16
+ label="{{ currentCard.kindLabel }}"
17
+ value="{{ currentCard.score }}"
18
+ tone="{{ meterTone }}"
19
+ />
20
+ <button class="panel__button" bindtap="nextCard">
21
+ 查看下一项能力
22
+ </button>
23
+ </view>
24
+
25
+ <hello-showcase
26
+ title="原生页中组合插件 Vue SFC 组件"
27
+ note="说明原生入口和 Vue SFC 入口可以在同一个插件工程里并存。"
28
+ entries="{{ cards }}"
29
+ />
30
+ </view>
@@ -0,0 +1,11 @@
1
+ {
2
+ "publicComponents": {
3
+ "hello-component": "components/hello-component/index",
4
+ "native-meter": "components/native-meter/index"
5
+ },
6
+ "pages": {
7
+ "hello-page": "pages/hello-page/index",
8
+ "native-playground": "pages/native-playground/index"
9
+ },
10
+ "main": "index.js"
11
+ }
@@ -0,0 +1,102 @@
1
+ import dayjs from 'dayjs'
2
+
3
+ export type PluginFeatureKind = 'vue-sfc' | 'native-ts' | 'scss'
4
+
5
+ export interface PluginFeatureCard {
6
+ id: string
7
+ title: string
8
+ summary: string
9
+ kind: PluginFeatureKind
10
+ kindLabel: string
11
+ score: number
12
+ }
13
+
14
+ const featureCards: PluginFeatureCard[] = [
15
+ {
16
+ id: 'vue-page',
17
+ title: '插件页面支持 Vue SFC',
18
+ summary: '页面直接使用 <script setup lang="ts">、definePageJson 与 wevu 响应式状态。',
19
+ kind: 'vue-sfc',
20
+ kindLabel: 'Vue SFC',
21
+ score: 96,
22
+ },
23
+ {
24
+ id: 'public-component',
25
+ title: '插件公开组件也可以是 Vue SFC',
26
+ summary: '宿主通过 plugin:// 引用 Vue SFC 组件,运行时仍保持小程序组件语义。',
27
+ kind: 'vue-sfc',
28
+ kindLabel: 'Vue SFC',
29
+ score: 91,
30
+ },
31
+ {
32
+ id: 'native-meter',
33
+ title: '插件原生组件支持 TypeScript',
34
+ summary: '原生 Component 入口可以写成 index.ts,并保留属性类型约束与默认值。',
35
+ kind: 'native-ts',
36
+ kindLabel: 'Native TS',
37
+ score: 88,
38
+ },
39
+ {
40
+ id: 'scss-pipeline',
41
+ title: '插件样式可直接走 SCSS 管线',
42
+ summary: '无论是原生组件的独立 .scss,还是 Vue SFC 的 <style lang="scss"> 都可正常编译。',
43
+ kind: 'scss',
44
+ kindLabel: 'SCSS',
45
+ score: 93,
46
+ },
47
+ ]
48
+
49
+ const pluginNpmBuildStamp = dayjs('2026-03-19T12:34:00').format('YYYY/MM/DD HH:mm')
50
+
51
+ /**
52
+ * 返回用于展示的插件能力卡片。
53
+ */
54
+ export function getFeatureCards() {
55
+ return featureCards.map(card => ({ ...card }))
56
+ }
57
+
58
+ /**
59
+ * 返回按类别筛选后的插件能力卡片。
60
+ */
61
+ export function getFeatureCardsByKind(kind: PluginFeatureKind | 'all') {
62
+ if (kind === 'all') {
63
+ return getFeatureCards()
64
+ }
65
+ return featureCards
66
+ .filter(card => card.kind === kind)
67
+ .map(card => ({ ...card }))
68
+ }
69
+
70
+ /**
71
+ * 返回能力类别的中文标签。
72
+ */
73
+ export function getFeatureKindLabel(kind: PluginFeatureKind) {
74
+ const labelMap: Record<PluginFeatureKind, string> = {
75
+ 'vue-sfc': 'Vue SFC',
76
+ 'native-ts': 'Native TS',
77
+ 'scss': 'SCSS',
78
+ }
79
+ return labelMap[kind]
80
+ }
81
+
82
+ /**
83
+ * 根据得分返回展示组件使用的色调。
84
+ */
85
+ export function getScoreTone(score: number) {
86
+ if (score >= 92) {
87
+ return 'success'
88
+ }
89
+ if (score >= 80) {
90
+ return 'neutral'
91
+ }
92
+ return 'danger'
93
+ }
94
+
95
+ /**
96
+ * 返回插件能力总览文案。
97
+ */
98
+ export function getPluginShowcaseSummary() {
99
+ const total = featureCards.length
100
+ const average = Math.round(featureCards.reduce((sum, item) => sum + item.score, 0) / total)
101
+ return `插件共暴露 ${total} 个示例切面,平均完成度 ${average}%,npm(dayjs) 构建标记 ${pluginNpmBuildStamp}`
102
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "description": "项目配置文件",
3
+ "miniprogramRoot": "dist/",
4
+ "pluginRoot": "dist-plugin/",
5
+ "compileType": "plugin",
6
+ "libVersion": "3.13.2",
7
+ "srcMiniprogramRoot": "dist/",
8
+ "appid": "touristappid",
9
+ "setting": {
10
+ "es6": true,
11
+ "postcss": false,
12
+ "compileWorklet": false,
13
+ "minified": false,
14
+ "uglifyFileName": false,
15
+ "uploadWithSourceMap": true,
16
+ "enhance": false,
17
+ "packNpmManually": true,
18
+ "packNpmRelationList": [
19
+ {
20
+ "packageJsonPath": "./package.json",
21
+ "miniprogramNpmDistDir": "./dist"
22
+ }
23
+ ],
24
+ "minifyWXSS": true,
25
+ "minifyWXML": true,
26
+ "localPlugins": false,
27
+ "condition": false,
28
+ "swc": false,
29
+ "disableSWC": true,
30
+ "babelSetting": {
31
+ "ignore": [],
32
+ "disablePlugins": [],
33
+ "outputPath": ""
34
+ },
35
+ "disableUseStrict": false,
36
+ "useCompilerPlugins": false
37
+ },
38
+ "simulatorPluginLibVersion": {},
39
+ "condition": {},
40
+ "packOptions": {
41
+ "ignore": [],
42
+ "include": []
43
+ },
44
+ "editorSetting": {
45
+ "tabIndent": "insertSpaces",
46
+ "tabSize": 2
47
+ }
48
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3
+ "libVersion": "3.15.0",
4
+ "projectname": "weapp-vite-plugin-template",
5
+ "setting": {
6
+ "compileHotReLoad": true
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ let loadCount = 0
2
+
3
+ export const SHARED_ANSWER = 42
4
+
5
+ /**
6
+ * Returns a string that identifies how many times this shared module has been evaluated.
7
+ * Plugin and miniprogram each log the value to verify their bundles do not reuse code.
8
+ */
9
+ export function getSharedLoadMessage(consumer: string) {
10
+ loadCount += 1
11
+ return `[shared:${consumer}] load #${loadCount}`
12
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "pages": [
3
+ "pages/index/index"
4
+ ],
5
+ "plugins": {
6
+ "hello-plugin": {
7
+ "version": "dev",
8
+ "provider": "touristappid"
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,5 @@
1
+ // app.js
2
+ App({
3
+ onLaunch() {
4
+ },
5
+ })
@@ -0,0 +1,6 @@
1
+ {
2
+ "usingComponents": {
3
+ "hello-showcase": "plugin://hello-plugin/hello-component",
4
+ "native-meter": "plugin://hello-plugin/native-meter"
5
+ }
6
+ }
@@ -0,0 +1,46 @@
1
+ import { getSharedLoadMessage } from '@/shared/shared-data'
2
+
3
+ interface PluginFeatureCard {
4
+ id: string
5
+ title: string
6
+ summary: string
7
+ kindLabel: string
8
+ score: number
9
+ }
10
+
11
+ interface HelloPlugin {
12
+ answer: number
13
+ getFeatureCards: () => PluginFeatureCard[]
14
+ getShowcaseSummary: () => string
15
+ sayHello: () => string
16
+ }
17
+
18
+ const plugin = requirePlugin('hello-plugin') as HelloPlugin
19
+
20
+ Page({
21
+ data: {
22
+ featureCards: [] as PluginFeatureCard[],
23
+ hostMessage: '',
24
+ pluginMessage: '',
25
+ pluginAnswer: 0,
26
+ pluginSummary: '',
27
+ showcaseProgress: 78,
28
+ },
29
+ onLoad() {
30
+ this.setData({
31
+ featureCards: plugin.getFeatureCards(),
32
+ hostMessage: getSharedLoadMessage('miniprogram'),
33
+ pluginMessage: plugin.sayHello(),
34
+ pluginAnswer: plugin.answer,
35
+ pluginSummary: plugin.getShowcaseSummary(),
36
+ })
37
+ },
38
+ boostShowcase() {
39
+ const nextValue = this.data.showcaseProgress >= 96
40
+ ? 72
41
+ : this.data.showcaseProgress + 6
42
+ this.setData({
43
+ showcaseProgress: nextValue,
44
+ })
45
+ },
46
+ })
@@ -0,0 +1,46 @@
1
+ <view class="page">
2
+ <view class="hero">
3
+ <text class="hero__eyebrow">weapp-vite plugin demo</text>
4
+ <text class="hero__title">插件能力混合演示</text>
5
+ <text class="hero__desc">
6
+ 宿主页面直接消费插件导出的 TS API,同时挂载插件公开组件,验证 plugin 场景下的多种编译入口。
7
+ </text>
8
+ </view>
9
+
10
+ <view class="panel">
11
+ <text class="panel__title">宿主拿到的插件信息</text>
12
+ <text class="panel__line">plugin.answer = {{ pluginAnswer }}</text>
13
+ <text class="panel__line">{{ hostMessage }}</text>
14
+ <text class="panel__line">{{ pluginMessage }}</text>
15
+ <text class="panel__line">{{ pluginSummary }}</text>
16
+ </view>
17
+
18
+ <view class="nav-grid">
19
+ <navigator class="nav-card" url="plugin://hello-plugin/hello-page">
20
+ <text class="nav-card__title">插件 Vue SFC 页面</text>
21
+ <text class="nav-card__desc">`script setup lang="ts"` + `lang="scss"` + wevu 响应式</text>
22
+ </navigator>
23
+ <navigator class="nav-card nav-card--alt" url="plugin://hello-plugin/native-playground">
24
+ <text class="nav-card__title">插件原生 TS 页面</text>
25
+ <text class="nav-card__desc">原生 `Page` + `ts` + 独立 `.scss` + 组件组合</text>
26
+ </navigator>
27
+ </view>
28
+
29
+ <hello-showcase
30
+ title="宿主直接渲染插件公开 Vue SFC 组件"
31
+ note="组件数据来自插件导出的 TS 模块,宿主只负责绑定。"
32
+ entries="{{ featureCards }}"
33
+ />
34
+
35
+ <view class="panel">
36
+ <text class="panel__title">宿主直接渲染插件公开原生组件</text>
37
+ <native-meter
38
+ label="Plugin Native Meter"
39
+ value="{{ showcaseProgress }}"
40
+ tone="success"
41
+ />
42
+ <button class="panel__button" bindtap="boostShowcase">
43
+ 切换插件原生组件进度
44
+ </button>
45
+ </view>
46
+ </view>
@@ -0,0 +1,113 @@
1
+ page {
2
+ min-height: 100%;
3
+ background:
4
+ radial-gradient(circle at top right, rgb(111 233 217 / 22%), transparent 30%),
5
+ linear-gradient(180deg, #f4f8ff 0%, #eef2fb 100%);
6
+ }
7
+
8
+ .page {
9
+ padding: 32rpx 24rpx 48rpx;
10
+ }
11
+
12
+ .hero,
13
+ .panel,
14
+ .nav-card {
15
+ box-sizing: border-box;
16
+ width: 100%;
17
+ border-radius: 28rpx;
18
+ }
19
+
20
+ .hero {
21
+ padding: 36rpx 32rpx;
22
+ color: #fff;
23
+ background: linear-gradient(135deg, #20365c 0%, #32518c 58%, #4b7ed1 100%);
24
+ box-shadow: 0 22rpx 48rpx rgb(34 58 99 / 18%);
25
+ }
26
+
27
+ .hero__eyebrow {
28
+ display: block;
29
+ margin-bottom: 12rpx;
30
+ font-size: 22rpx;
31
+ text-transform: uppercase;
32
+ letter-spacing: 3rpx;
33
+ opacity: 0.72;
34
+ }
35
+
36
+ .hero__title {
37
+ display: block;
38
+ font-size: 42rpx;
39
+ font-weight: 700;
40
+ line-height: 1.25;
41
+ }
42
+
43
+ .hero__desc {
44
+ display: block;
45
+ margin-top: 18rpx;
46
+ font-size: 26rpx;
47
+ line-height: 1.7;
48
+ opacity: 0.92;
49
+ }
50
+
51
+ .panel {
52
+ padding: 28rpx;
53
+ margin-top: 24rpx;
54
+ background: rgb(255 255 255 / 88%);
55
+ box-shadow: 0 12rpx 30rpx rgb(62 86 124 / 10%);
56
+ }
57
+
58
+ .panel__title {
59
+ display: block;
60
+ margin-bottom: 16rpx;
61
+ font-size: 30rpx;
62
+ font-weight: 600;
63
+ color: #1e2c47;
64
+ }
65
+
66
+ .panel__line {
67
+ display: block;
68
+ margin-top: 10rpx;
69
+ font-size: 25rpx;
70
+ line-height: 1.7;
71
+ color: #52627f;
72
+ }
73
+
74
+ .panel__button {
75
+ margin-top: 20rpx;
76
+ font-size: 26rpx;
77
+ color: #fff;
78
+ background: #284a82;
79
+ border-radius: 999rpx;
80
+ }
81
+
82
+ .nav-grid {
83
+ display: flex;
84
+ gap: 20rpx;
85
+ margin-top: 24rpx;
86
+ }
87
+
88
+ .nav-card {
89
+ flex: 1;
90
+ min-height: 196rpx;
91
+ padding: 28rpx;
92
+ background: linear-gradient(180deg, #fbfdff 0%, #f3f7ff 100%);
93
+ box-shadow: 0 12rpx 26rpx rgb(72 97 136 / 10%);
94
+ }
95
+
96
+ .nav-card--alt {
97
+ background: linear-gradient(180deg, #fffdf7 0%, #fff4db 100%);
98
+ }
99
+
100
+ .nav-card__title {
101
+ display: block;
102
+ font-size: 30rpx;
103
+ font-weight: 600;
104
+ color: #1d2c47;
105
+ }
106
+
107
+ .nav-card__desc {
108
+ display: block;
109
+ margin-top: 14rpx;
110
+ font-size: 24rpx;
111
+ line-height: 1.65;
112
+ color: #5d6a82;
113
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "desc": "本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3
+ "rules": [{
4
+ "action": "allow",
5
+ "page": "*"
6
+ }]
7
+ }
@@ -0,0 +1,5 @@
1
+ import { icebreaker } from '@icebreakers/stylelint-config'
2
+
3
+ export default icebreaker({
4
+ miniProgram: true,
5
+ })
@@ -0,0 +1,17 @@
1
+ {
2
+ "references": [
3
+ {
4
+ "path": "./.weapp-vite/tsconfig.app.json"
5
+ },
6
+ {
7
+ "path": "./.weapp-vite/tsconfig.server.json"
8
+ },
9
+ {
10
+ "path": "./.weapp-vite/tsconfig.node.json"
11
+ },
12
+ {
13
+ "path": "./.weapp-vite/tsconfig.shared.json"
14
+ }
15
+ ],
16
+ "files": []
17
+ }
@@ -0,0 +1,23 @@
1
+ import { defineConfig } from 'weapp-vite/config'
2
+
3
+ export default defineConfig({
4
+ weapp: {
5
+ srcRoot: 'src',
6
+ pluginRoot: 'plugin',
7
+ typescript: {
8
+ app: {
9
+ compilerOptions: {
10
+ paths: {
11
+ '@/*': ['./*'],
12
+ },
13
+ },
14
+ },
15
+ },
16
+ npm: {
17
+ enable: true,
18
+ pluginPackage: {
19
+ dependencies: ['dayjs'],
20
+ },
21
+ },
22
+ },
23
+ })
@@ -2,5 +2,8 @@ import { icebreaker } from '@icebreakers/eslint-config'
2
2
 
3
3
  export default icebreaker({
4
4
  miniProgram: true,
5
- ignores: ['CHANGELOG.md', 'README.md', '.turbo/**'],
5
+ tailwindcss: {
6
+ entryPoint: './src/app.css',
7
+ },
8
+ ignores: ['CHANGELOG.md', 'README.md', '.turbo/**', 'dist/**', '.weapp-vite/**'],
6
9
  })
@@ -32,13 +32,14 @@
32
32
  "@icebreakers/eslint-config": "catalog:",
33
33
  "@icebreakers/stylelint-config": "catalog:",
34
34
  "@iconify-json/mdi": "catalog:",
35
- "autoprefixer": "catalog:",
35
+ "@tailwindcss/postcss": "catalog:",
36
+ "@types/node": "catalog:",
36
37
  "eslint": "catalog:",
37
38
  "miniprogram-api-typings": "catalog:",
38
39
  "postcss": "catalog:",
39
40
  "sass": "catalog:",
40
41
  "stylelint": "catalog:",
41
- "tailwindcss": "catalog:tailwind3",
42
+ "tailwindcss": "catalog:tailwind4",
42
43
  "typescript": "catalog:",
43
44
  "weapp-tailwindcss": "catalog:",
44
45
  "weapp-vite": "workspace:*",
@@ -1,6 +1,5 @@
1
1
  export default {
2
2
  plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
3
+ '@tailwindcss/postcss': {},
5
4
  },
6
5
  }
@@ -0,0 +1,2 @@
1
+ @import 'tailwindcss';
2
+ @config "../tailwind.config.ts";
@@ -0,0 +1 @@
1
+ /* empty */
@@ -0,0 +1 @@
1
+ /* empty */
@@ -14,9 +14,4 @@ export default {
14
14
  collections: getIconCollections(['mdi']),
15
15
  }),
16
16
  ],
17
- corePlugins: {
18
- // 小程序不需要 preflight 和 container,因为这主要是给 h5 的,如果你要同时开发小程序和 h5 端,你应该使用环境变量来控制它
19
- preflight: false,
20
- container: false,
21
- },
22
17
  } satisfies Config
@@ -1,3 +1,4 @@
1
+ import path from 'node:path'
1
2
  import { weappTailwindcss } from 'weapp-tailwindcss/vite'
2
3
  import { defineConfig } from 'weapp-vite'
3
4
 
@@ -32,6 +33,7 @@ export default defineConfig({
32
33
  plugins: [
33
34
  weappTailwindcss({
34
35
  rem2rpx: true,
36
+ cssEntries: [path.resolve(import.meta.dirname, 'src/app.css')],
35
37
  }),
36
38
  ],
37
39
  })
@@ -2,5 +2,8 @@ import { icebreaker } from '@icebreakers/eslint-config'
2
2
 
3
3
  export default icebreaker({
4
4
  miniProgram: true,
5
- ignores: ['CHANGELOG.md', 'README.md', '.turbo/**'],
5
+ tailwindcss: {
6
+ entryPoint: './src/app.css',
7
+ },
8
+ ignores: ['CHANGELOG.md', 'README.md', '.turbo/**', 'dist/**', '.weapp-vite/**'],
6
9
  })
@@ -35,13 +35,14 @@
35
35
  "@icebreakers/eslint-config": "catalog:",
36
36
  "@icebreakers/stylelint-config": "catalog:",
37
37
  "@iconify-json/mdi": "catalog:",
38
- "autoprefixer": "catalog:",
38
+ "@tailwindcss/postcss": "catalog:",
39
+ "@types/node": "catalog:",
39
40
  "eslint": "catalog:",
40
41
  "miniprogram-api-typings": "catalog:",
41
42
  "postcss": "catalog:",
42
43
  "sass": "catalog:",
43
44
  "stylelint": "catalog:",
44
- "tailwindcss": "catalog:tailwind3",
45
+ "tailwindcss": "catalog:tailwind4",
45
46
  "typescript": "catalog:",
46
47
  "weapp-tailwindcss": "catalog:",
47
48
  "weapp-vite": "workspace:*",
@@ -1,6 +1,5 @@
1
1
  export default {
2
2
  plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
3
+ '@tailwindcss/postcss': {},
5
4
  },
6
5
  }
@@ -0,0 +1,2 @@
1
+ @import 'tailwindcss';
2
+ @config "../tailwind.config.ts";
@@ -0,0 +1 @@
1
+ /* empty */
@@ -14,9 +14,4 @@ export default {
14
14
  collections: getIconCollections(['mdi']),
15
15
  }),
16
16
  ],
17
- corePlugins: {
18
- // 小程序不需要 preflight 和 container,因为这主要是给 h5 的,如果你要同时开发小程序和 h5 端,你应该使用环境变量来控制它
19
- preflight: false,
20
- container: false,
21
- },
22
17
  } satisfies Config
@@ -1,3 +1,4 @@
1
+ import path from 'node:path'
1
2
  import { weappTailwindcss } from 'weapp-tailwindcss/vite'
2
3
  import { defineConfig } from 'weapp-vite'
3
4
  import { TDesignResolver } from 'weapp-vite/auto-import-components/resolvers'
@@ -45,6 +46,7 @@ export default defineConfig({
45
46
  plugins: [
46
47
  weappTailwindcss({
47
48
  rem2rpx: true,
49
+ cssEntries: [path.resolve(import.meta.dirname, 'src/app.css')],
48
50
  }),
49
51
  ],
50
52
  })