更新 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,7 +2365,17 @@ if (typeof window !== 'undefined') {
delete d[i];
}
}
code = JSON.stringify(d);
// 转字符串不然会报错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);
}
}
return {
code,

View File

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

View File

@ -156,7 +156,18 @@ export function codePlugin(): Plugin[] {
}
}
code = JSON.stringify(d);
// 转字符串不然会报错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);
}
}
return {

View File

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