Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vite-plugin-blocklet): fix blockletPrefix without trailingSlash cause vite error #356

Merged
merged 4 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.4 (2024-8-29)

- fix(vite-plugin-blocklet): fix blockletPrefix without trailingSlash cause vite error

## 0.9.3 (2024-8-27)

- fix(vite-plugin-blocklet): should not use top await with export
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "create-blocklet",
"private": true,
"version": "0.9.3",
"version": "0.9.4",
"description": "",
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-blocklet",
"version": "0.9.3",
"version": "0.9.4",
"exports": "./index.js",
"type": "module",
"repository": "[email protected]:blocklet/create-blocklet.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/react-dapp-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.5.2",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/react-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"rimraf": "^5.0.7",
"simple-git-hooks": "^2.11.1",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/react-gun-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"rimraf": "^5.0.7",
"simple-git-hooks": "^2.11.1",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/react-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"rimraf": "^5.0.7",
"simple-git-hooks": "^2.11.1",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/solidjs-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"rimraf": "^5.0.7",
"simple-git-hooks": "^2.11.1",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vite-plugin-solid": "^2.10.2",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/solidjs-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"simple-git-hooks": "^2.11.1",
"solid-js": "^1.8.18",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vite-plugin-solid": "^2.10.2",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/svelte-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"simple-git-hooks": "^2.11.1",
"svelte": "^4.2.18",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"zx": "^8.1.4"
},
"lint-staged": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/svelte-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"simple-git-hooks": "^2.11.1",
"svelte": "^4.2.18",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"zx": "^8.1.4"
},
"lint-staged": {
Expand Down
8 changes: 4 additions & 4 deletions packages/create-app/templates/todo-list-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
"nanoid": "^5.0.7"
},
"devDependencies": {
"@arcblock/did-connect": "^2.10.25",
"@arcblock/did-connect": "^2.10.26",
"@arcblock/eslint-config": "^0.3.2",
"@arcblock/eslint-config-ts": "^0.3.2",
"@arcblock/ux": "^2.10.25",
"@arcblock/ux": "^2.10.26",
"@blocklet/js-sdk": "^1.16.30",
"@blocklet/ui-react": "^2.10.25",
"@blocklet/ui-react": "^2.10.26",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^5.15.21",
Expand Down Expand Up @@ -95,7 +95,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.5.2",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/vue-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"rimraf": "^5.0.7",
"simple-git-hooks": "^2.11.1",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vue": "^3.4.31",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/vue-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"rimraf": "^5.0.7",
"simple-git-hooks": "^2.11.1",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vue": "^3.4.31",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/vue-ts-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"taze": "^0.16.3",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vue-tsc": "^2.0.29",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/vue2-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"rimraf": "^5.0.7",
"simple-git-hooks": "^2.11.1",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vue": "^2.7.16",
"zx": "^8.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/vue2-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"rimraf": "^5.0.7",
"simple-git-hooks": "^2.11.1",
"vite": "^5.3.5",
"vite-plugin-blocklet": "^0.9.3",
"vite-plugin-blocklet": "^0.9.4",
"vue": "^2.7.16",
"zx": "^8.1.4"
},
Expand Down
6 changes: 5 additions & 1 deletion plugins/vite-plugin-blocklet/libs/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { joinURL, withTrailingSlash } from 'ufo';
import { isEqual, joinURL, withTrailingSlash } from 'ufo';
import { toBlockletDid, isInBlocklet, blockletPort, blockletPrefix, getBlockletYAML } from './utils.js';

export default function createConfigPlugin() {
Expand All @@ -11,6 +11,10 @@ export default function createConfigPlugin() {
if (!req.url.startsWith(blockletPrefix)) {
req.url = joinURL(blockletPrefix || '/', req.url);
}
// NOTICE: 由于传递给 vite 的 base 是带有结尾 slash 的,所以需要确保传递的 vite 的 url 在等于 blockletPrefix 也一定要带有结尾 slash
if (isEqual(req.url, blockletPrefix)) {
req.url = withTrailingSlash(req.url);
}
return next();
});
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/vite-plugin-blocklet/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vite-plugin-blocklet",
"type": "module",
"version": "0.9.3",
"version": "0.9.4",
"description": "",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion plugins/vite-plugin-wss-hmr/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vite-plugin-wss-hmr",
"type": "module",
"version": "0.9.3",
"version": "0.9.4",
"description": "",
"main": "index.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.3
0.9.4
2 changes: 1 addition & 1 deletion website/docs/blocklet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository:
type: git
url: git+https://github.com/blocklet/create-blocklet.git
specVersion: 1.2.8
version: 0.9.3
version: 0.9.4
logo: logo.png
files:
- logo.png
Expand Down
2 changes: 1 addition & 1 deletion website/pages/blocklet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository:
type: git
url: git+https://github.com/blocklet/create-blocklet.git
specVersion: 1.2.8
version: 0.9.3
version: 0.9.4
logo: logo.png
files:
- logo.png
Expand Down
Loading