✨ feat(vscode): 代码阅读预览界面
Vite 加 code-reader.html 第二入口;代码块树(层级竖线、折叠、种类标签配色)、译文 / 源码按词性着色、块内直接编辑(防抖回写整行、Esc 回预览)、翻译下拉、解析失败提示;看板与代码阅读共用带类型的 acquireVsCodeApi 包装和 ErrorBoundary。
This commit is contained in:
1 parent
cab5ac0ebc
commit
af56985d9a
16 files changed
+775
-74
No files matched your search
@@ -9,10 +9,19 @@ export default defineConfig({
|
||||
build: {
|
||||
outDir: '../dist/webview-ui',
|
||||
emptyOutDir: true,
|
||||
// webview 的 CSP 只放行带 nonce 的 <script>,Vite 注入的 modulepreload <link> 会被拦下报错;
|
||||
// 本地资源预加载也没有收益。入口脚本 import 的共享块会继承 nonce,照常加载。
|
||||
modulePreload: false,
|
||||
rollupOptions: {
|
||||
// 两个 webview 页面:看板(index.html)和代码阅读预览(code-reader.html)
|
||||
input: {
|
||||
'index': path.resolve(__dirname, 'index.html'),
|
||||
'code-reader': path.resolve(__dirname, 'code-reader.html'),
|
||||
},
|
||||
output: {
|
||||
entryFileNames: 'assets/[name].js',
|
||||
chunkFileNames: 'assets/[name].js',
|
||||
// 入口由加载方按 mtime 加 ?v= 防缓存,入口 import 的共享块(React 等)没有这一步,只能靠文件名带内容哈希
|
||||
chunkFileNames: 'assets/[name]-[hash].js',
|
||||
assetFileNames: 'assets/[name].[ext]',
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user