Compare commits

...
Author SHA1 Message Date
ShareVB 1631a21534 fix: optimize monaco-editor loading (locally) 2025-05-18 23:15:45 +02:00
ShareVB 2c30f830e9 chore: try optimization 2025-05-18 21:45:01 +02:00
3 changed files with 7 additions and 10 deletions

No files matched your search

-7
View File
@@ -4,9 +4,6 @@ import { createHead } from '@vueuse/head';
import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { install as VueMonacoEditorPlugin, loader } from '@guolao/vue-monaco-editor';
import * as monaco from 'monaco-editor';
import { registerSW } from 'virtual:pwa-register';
import shadow from 'vue-shadow-dom';
import { plausible } from './plugins/plausible.plugin';
@@ -23,14 +20,10 @@ import store from './tools/pomodoro-timer/app/store';
library.add(fas);
// loaded monaco-editor from `node_modules`
loader.config({ monaco });
registerSW();
const app = createApp(App);
app.use(VueMonacoEditorPlugin);
app.use(createPinia());
app.use(createHead());
app.use(i18nPlugin);
+5 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import * as monacoEditor from 'monaco-editor';
import { VueMonacoEditor, loader } from '@guolao/vue-monaco-editor';
import type { MonacoEditor } from '@guolao/vue-monaco-editor';
import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
@@ -53,6 +54,9 @@ globalThis.MonacoEnvironment = {
},
};
// loaded monaco-editor from `node_modules`
loader.config({ monaco: monacoEditor });
export interface EditorProps {
defaultValue?: string
defaultPath?: string
@@ -113,7 +117,7 @@ export default {
</script>
<template>
<vue-monaco-editor
<VueMonacoEditor
v-bind="inheritedAttrs"
v-model:value="value"
@before-mount="(monaco: MonacoEditor) => emits('beforeMount', monaco)"
+2 -2
View File
@@ -130,13 +130,13 @@ export default defineConfig({
minify: !process.env.VERCEL,
reportCompressedSize: !process.env.VERCEL,
// cssMinify: false,
modulePreload: false,
// modulePreload: false,
rollupOptions: {
external: ['regex', './out/isolated_vm', 'isolated-vm', 'onnxruntime-node'],
output: {
format: 'es',
manualChunks: (id) => {
if (id.includes('monaco-editor')) return 'monaco-editor';
// if (id.includes('monaco-editor')) return 'monaco-editor';
if (id.includes('tesseract.js')) return 'tesseract.js';
if (id.includes('pdfjs')) return 'pdfjs';
if (id.includes('unicode')) return 'unicode';