更新 uniappx 语言插件

This commit is contained in:
icssoa 2025-08-26 09:54:52 +08:00
parent 798ecc7304
commit e125957ef5
4 changed files with 24 additions and 6 deletions

View File

@ -2365,8 +2365,18 @@ if (typeof window !== 'undefined') {
delete d[i]; delete d[i];
} }
} }
// 转字符串不然会报错Method too large
if (id.includes("/locale/")) {
let t = [];
d.forEach(([a, b]) => {
t.push(`${a}<__=__>${b}`);
});
code = JSON.stringify([[t.join("<__&__>")]]);
}
else {
code = JSON.stringify(d); code = JSON.stringify(d);
} }
}
return { return {
code, code,
map: { mappings: "" }, map: { mappings: "" },

View File

@ -1,6 +1,6 @@
{ {
"name": "@cool-vue/vite-plugin", "name": "@cool-vue/vite-plugin",
"version": "8.2.6", "version": "8.2.7",
"description": "cool-admin、cool-uni builder", "description": "cool-admin、cool-uni builder",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"main": "/dist/index.js", "main": "/dist/index.js",

View File

@ -156,8 +156,19 @@ export function codePlugin(): Plugin[] {
} }
} }
// 转字符串不然会报错Method too large
if (id.includes("/locale/")) {
let t: string[] = [];
(d as string[][]).forEach(([a, b]) => {
t.push(`${a}<__=__>${b}`);
});
code = JSON.stringify([[t.join("<__&__>")]]);
} else {
code = JSON.stringify(d); code = JSON.stringify(d);
} }
}
return { return {
code, code,

View File

@ -94,9 +94,6 @@ function postcssPlugin(): Plugin {
{ {
postcssPlugin: "vite-cool-uniappx-class-mapping", postcssPlugin: "vite-cool-uniappx-class-mapping",
prepare() { prepare() {
// 存储 Tailwind 颜色值
const colorValues: Record<string, string> = {};
return { return {
// 处理选择器规则 // 处理选择器规则
Rule(rule: any) { Rule(rule: any) {