Skip to content

Commit

Permalink
fix(unocss): windows mp-weixin dev error
Browse files Browse the repository at this point in the history
close #17
  • Loading branch information
KeJunMao committed Sep 22, 2023
1 parent 35cb11c commit bc3833f
Show file tree
Hide file tree
Showing 3 changed files with 254 additions and 170 deletions.
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"vue-i18n": "^9.4.1"
},
"devDependencies": {
"@antfu/eslint-config": "^0.43.0",
"@antfu/eslint-config": "^0.43.1",
"@dcloudio/types": "^3.3.3",
"@dcloudio/uni-automator": "3.0.0-alpha-3090020230909001",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3090020230909001",
Expand All @@ -74,23 +74,28 @@
"@types/node": "^20.6.3",
"@uni-helper/uni-app-types": "^0.5.10",
"@uni-helper/uni-env": "^0.0.3",
"@uni-helper/vite-plugin-uni-components": "^0.0.6",
"@uni-helper/vite-plugin-uni-components": "^0.0.8",
"@uni-helper/vite-plugin-uni-layouts": "^0.1.3",
"@uni-helper/vite-plugin-uni-manifest": "^0.2.1",
"@uni-helper/vite-plugin-uni-pages": "^0.2.11",
"@uni-helper/volar-service-uni-pages": "^0.2.11",
"@unocss/eslint-config": "^0.55.7",
"@unocss/eslint-config": "^0.56.1",
"@vue/tsconfig": "^0.4.0",
"eslint": "^8.49.0",
"lint-staged": "^14.0.1",
"simple-git-hooks": "^2.9.0",
"typescript": "^5.2.2",
"unocss": "^0.55.7",
"unocss": "^0.56.1",
"unocss-applet": "^0.5.5",
"unplugin-auto-import": "^0.16.6",
"vite": "4.4.9",
"vue-tsc": "^1.8.13"
},
"pnpm": {
"patchedDependencies": {
"@unocss/[email protected]": "patches/@[email protected]"
}
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
Expand Down
46 changes: 46 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/dist/index.cjs b/dist/index.cjs
index 44f299a69ca67ec061bc5ce1b4109270e48b7aa6..25022d1287d3469f18e446ac36bab83b92489d61 100644
--- a/dist/index.cjs
+++ b/dist/index.cjs
@@ -35,15 +35,15 @@ const VIRTUAL_ENTRY_ALIAS = [
/^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
];
const LAYER_MARK_ALL = "__ALL__";
-const RESOLVED_ID_WITH_QUERY_RE = /[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
-const RESOLVED_ID_RE = /[\/\\]__uno(?:(_.*?))?\.css$/;
+const RESOLVED_ID_WITH_QUERY_RE = /__uno(?:(_.*?))?\.css(\?.*)?$/;
+const RESOLVED_ID_RE = /__uno(?:(_.*?))?\.css$/;
function resolveId(id) {
if (id.match(RESOLVED_ID_WITH_QUERY_RE))
return id;
for (const alias of VIRTUAL_ENTRY_ALIAS) {
const match = id.match(alias);
if (match) {
- return match[1] ? `/__uno_${match[1]}.css` : "/__uno.css";
+ return match[1] ? `__uno_${match[1]}.css` : "__uno.css";
}
}
}
diff --git a/dist/index.mjs b/dist/index.mjs
index 247735a319181f62ef77cebd12ff2fd655d8082c..8f2f36887218b2683570059033f96126cdd3b038 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -20,15 +20,15 @@ const VIRTUAL_ENTRY_ALIAS = [
/^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
];
const LAYER_MARK_ALL = "__ALL__";
-const RESOLVED_ID_WITH_QUERY_RE = /[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
-const RESOLVED_ID_RE = /[\/\\]__uno(?:(_.*?))?\.css$/;
+const RESOLVED_ID_WITH_QUERY_RE = /__uno(?:(_.*?))?\.css(\?.*)?$/;
+const RESOLVED_ID_RE = /__uno(?:(_.*?))?\.css$/;
function resolveId(id) {
if (id.match(RESOLVED_ID_WITH_QUERY_RE))
return id;
for (const alias of VIRTUAL_ENTRY_ALIAS) {
const match = id.match(alias);
if (match) {
- return match[1] ? `/__uno_${match[1]}.css` : "/__uno.css";
+ return match[1] ? `__uno_${match[1]}.css` : "__uno.css";
}
}
}
Loading

0 comments on commit bc3833f

Please sign in to comment.