chore: add vs dist server for monaco -- change path
This commit is contained in:
@@ -37,11 +37,6 @@ func initStaticRoutes(root *gin.RouterGroup) {
|
|||||||
assetsGroup.Use(cacheControl("public, max-age=31536000, immutable")) // 带哈希的资源缓存
|
assetsGroup.Use(cacheControl("public, max-age=31536000, immutable")) // 带哈希的资源缓存
|
||||||
assetsGroup.StaticFS("/", http.FS(mustSubFS(staticFS, "assets")))
|
assetsGroup.StaticFS("/", http.FS(mustSubFS(staticFS, "assets")))
|
||||||
|
|
||||||
// Monaco Editor (vs) 静态资源
|
|
||||||
vsGroup := root.Group("/vs")
|
|
||||||
vsGroup.Use(cacheControl("public, max-age=31536000, immutable"))
|
|
||||||
vsGroup.StaticFS("/", http.FS(mustSubFS(staticFS, "vs")))
|
|
||||||
|
|
||||||
// logo.svg 短缓存实现
|
// logo.svg 短缓存实现
|
||||||
root.GET("/logo.svg", func(ctx *gin.Context) {
|
root.GET("/logo.svg", func(ctx *gin.Context) {
|
||||||
data, err := static.ReadFile("logo.svg")
|
data, err := static.ReadFile("logo.svg")
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ createApp(App)
|
|||||||
.use(router)
|
.use(router)
|
||||||
.use(VueMonacoEditorPlugin, {
|
.use(VueMonacoEditorPlugin, {
|
||||||
paths: {
|
paths: {
|
||||||
vs: BASE_URL + '/vs'
|
vs: BASE_URL + '/assets/vs'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.mount('#app')
|
.mount('#app')
|
||||||
|
|||||||
+6
-1
@@ -12,7 +12,7 @@ export default defineConfig({
|
|||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
src: 'node_modules/monaco-editor/min/vs',
|
src: 'node_modules/monaco-editor/min/vs',
|
||||||
dest: '.'
|
dest: 'assets'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -53,5 +53,10 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
define: {
|
||||||
|
// Define MONACO_BASE_URL for monaco-editor to correctly load its workers and assets
|
||||||
|
// This path should match the destination of viteStaticCopy for monaco-editor's 'vs' folder
|
||||||
|
MONACO_BASE_URL: JSON.stringify('./assets/vs')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user