Skip to content

Commit 424b445

Browse files
committed
fix: workPath to use absolute path (#19)
1 parent b511411 commit 424b445

File tree

6 files changed

+32
-7
lines changed

6 files changed

+32
-7
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"monaco-graphql": "^0.4.4",
4444
"typescript": "^4.3.5",
4545
"vite": "^2.4.4",
46-
"vue": "^3.1.5"
46+
"vue": "^3.1.5",
47+
"vue-router": "^4.0.12"
4748
},
4849
"peerDependencies": {
4950
"monaco-editor": "0.29.x"

src/workerMiddleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function getWorkPath(works: IWorkerDefinition[], options: IMonacoEditorOp
1919
if (isCDN(options.publicPath)) {
2020
workerPaths[work.label] = options.publicPath + '/' + getFilenameByEntry(work.entry);
2121
} else {
22-
workerPaths[work.label] = './' + options.publicPath + '/' + getFilenameByEntry(work.entry);
22+
workerPaths[work.label] = '/' + options.publicPath + '/' + getFilenameByEntry(work.entry);
2323
}
2424
}
2525

test/src/App.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<template>
2-
<Editor ></Editor>
2+
<router-view></router-view>
33
</template>
44

5-
<script setup>
6-
import Editor from "./mona/Editor.vue"
7-
</script>
5+
<script setup></script>

test/src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createApp } from 'vue'
22
import App from './App.vue'
3+
import router from './router/index';
34

4-
createApp(App).mount('#app')
5+
createApp(App).use(router).mount('#app')

test/src/router/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { createRouter, createWebHistory } from 'vue-router';
2+
3+
const routes = [
4+
{ path: '/', component: () => import('../mona/Editor.vue') },
5+
{ path: '/home/test', component: () => import('../mona/Editor.vue') },
6+
];
7+
8+
const router = createRouter({
9+
history: createWebHistory(),
10+
routes,
11+
});
12+
13+
export default router;

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@
102102
"@vue/compiler-dom" "3.1.5"
103103
"@vue/shared" "3.1.5"
104104

105+
"@vue/devtools-api@^6.0.0-beta.18":
106+
version "6.0.0-beta.20.1"
107+
resolved "https://registry.npmmirror.com/@vue/devtools-api/download/@vue/devtools-api-6.0.0-beta.20.1.tgz#5b499647e929c35baf2a66a399578f9aa4601142"
108+
integrity sha512-R2rfiRY+kZugzWh9ZyITaovx+jpU4vgivAEAiz80kvh3yviiTU3CBuGuyWpSwGz9/C7TkSWVM/FtQRGlZ16n8Q==
109+
105110
"@vue/reactivity@3.1.5":
106111
version "3.1.5"
107112
resolved "https://registry.nlark.com/@vue/reactivity/download/@vue/reactivity-3.1.5.tgz?cache=0&sync_timestamp=1628306156758&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vue%2Freactivity%2Fdownload%2F%40vue%2Freactivity-3.1.5.tgz#dbec4d9557f7c8f25c2635db1e23a78a729eb991"
@@ -668,6 +673,13 @@ vscode-languageserver-types@^3.15.1:
668673
resolved "https://registry.npmmirror.com/vscode-languageserver-types/download/vscode-languageserver-types-3.16.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fvscode-languageserver-types%2Fdownload%2Fvscode-languageserver-types-3.16.0.tgz#ecf393fc121ec6974b2da3efb3155644c514e247"
669674
integrity sha1-7POT/BIexpdLLaPvsxVWRMUU4kc=
670675

676+
vue-router@^4.0.12:
677+
version "4.0.12"
678+
resolved "https://registry.npmmirror.com/vue-router/download/vue-router-4.0.12.tgz#8dc792cddf5bb1abcc3908f9064136de7e13c460"
679+
integrity sha1-jceSzd9bsavMOQj5BkE23n4TxGA=
680+
dependencies:
681+
"@vue/devtools-api" "^6.0.0-beta.18"
682+
671683
vue@^3.1.5:
672684
version "3.1.5"
673685
resolved "https://registry.nlark.com/vue/download/vue-3.1.5.tgz?cache=0&sync_timestamp=1628306160765&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue%2Fdownload%2Fvue-3.1.5.tgz#12879b11d0685ee4478c8869551799630a52f9fe"

0 commit comments

Comments
 (0)