{"_id":"@dvaji/vite-plugin-monaco-editor","name":"@dvaji/vite-plugin-monaco-editor","dist-tags":{"latest":"2.0.0"},"versions":{"2.0.0":{"name":"@dvaji/vite-plugin-monaco-editor","version":"2.0.0","description":"A vite plugin for the Monaco Editor (Vite 8 fork)","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"build":"tsc","prepublishOnly":"npm run copy:cdn","test:build":"npm run build && vite build --config test/vite.config.js","test:dev":"npm run build && vite --config test/vite.config.js","test:preview":"vite preview --config test/vite.config.js","simulator:cdn":"http-server cdn/ --port 8888","copy:cdn":"node script/updateCDN.js"},"author":"dvaji","contributors":["china-bin (original author)"],"license":"MIT","keywords":["vite-plugin","monaco","editor","vite-8","rolldown"],"repository":{"type":"git","url":"https://github.com/dvaJi/vite-plugin-monaco-editor"},"homepage":"https://github.com/dvaJi/vite-plugin-monaco-editor#readme","bugs":{"url":"https://github.com/dvaJi/vite-plugin-monaco-editor/issues"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"engines":{"node":"^20.19.0 || >=22.12.0"},"devDependencies":{"@okikio/sharedworker":"^1.1.0","@types/fs-extra":"^11.0.4","@types/node":"^25.9.3","@vitejs/plugin-vue":"^6.0.7","@vue/compiler-sfc":"^3.5.38","fs-extra":"^11.3.5","http-server":"^14.1.1","monaco-editor":"^0.55.1","monaco-graphql":"2.0.0-canary-f648417e.0","typescript":"^6.0.3","vite":"^8.0.16","vue":"^3.5.38","vue-router":"^5.1.0"},"dependencies":{"rolldown":"^1.1.2"},"peerDependencies":{"monaco-editor":">=0.33.0"},"_id":"@dvaji/vite-plugin-monaco-editor@2.0.0","_integrity":"sha512-41Pib2alAkFWHEF2BgqF1Gllr53DDeLOwwfuECtyba9Prizrhd79tZtoqD+LU1+2S/im3tbDZ185VrJ5IVralQ==","_nodeVersion":"24.3.0","_npmVersion":"10.8.3","shasum":"80ed12fc91767f425b83aa62544c8f79a6958dc1","dist":{"integrity":"sha512-41Pib2alAkFWHEF2BgqF1Gllr53DDeLOwwfuECtyba9Prizrhd79tZtoqD+LU1+2S/im3tbDZ185VrJ5IVralQ==","shasum":"80ed12fc91767f425b83aa62544c8f79a6958dc1","tarball":"https://registry.npmjs.org/@dvaji/vite-plugin-monaco-editor/-/vite-plugin-monaco-editor-2.0.0.tgz","fileCount":16,"unpackedSize":17108633,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCSc5srGyydthqdLHZzZ1dHb0WG4HCWL06X3Ql1j535kwIgS7pglz3sVTWVfL2uxPUsPDi/C263KEyWlgfOxKTPTZk="}]},"_npmUser":{"name":"dvaji","email":"francisco_p@outlook.com"},"directories":{},"maintainers":[{"name":"dvaji","email":"francisco_p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-plugin-monaco-editor_2.0.0_1781841076255_0.9091024375784948"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-19T03:51:16.009Z","2.0.0":"2026-06-19T03:51:16.572Z","modified":"2026-06-19T03:51:16.794Z"},"maintainers":[{"name":"dvaji","email":"francisco_p@outlook.com"}],"description":"A vite plugin for the Monaco Editor (Vite 8 fork)","homepage":"https://github.com/dvaJi/vite-plugin-monaco-editor#readme","keywords":["vite-plugin","monaco","editor","vite-8","rolldown"],"repository":{"type":"git","url":"https://github.com/dvaJi/vite-plugin-monaco-editor"},"contributors":["china-bin (original author)"],"author":"dvaji","bugs":{"url":"https://github.com/dvaJi/vite-plugin-monaco-editor/issues"},"license":"MIT","readme":"# Vite Plugin Monaco Editor\r\n\r\nA plugin to simplify loading the [Monaco Editor](https://github.com/Microsoft/monaco-editor) with [vite](https://vitejs.dev/).\r\n\r\n> **Fork note:** This is a Vite 8 compatible fork of [`vite-plugin-monaco-editor`](https://github.com/vdesjs/vite-plugin-monaco-editor). It replaces esbuild with [rolldown](https://rolldown.rs/) (Vite 8's bundler) and migrates the plugin to ESM.\r\n\r\n- It uses Vite specific plugin hooks: configResolved, configureServer, transformIndexHtml.\r\n- It uses rolldown to bundle worker in the `node_modules/.monaco` directory, via the `server.middlewares` proxy http server for the bundle worker.\r\n\r\n## Installing\r\n\r\n```ts\r\n// make sure you have it installed monaco-editor.\r\n\r\nyarn add @dvaji/vite-plugin-monaco-editor -D\r\n\r\n// or\r\nnpm install --save-dev @dvaji/vite-plugin-monaco-editor\r\n```\r\n\r\n## Using\r\n\r\n- `vite.config.ts`:\r\n\r\n```ts\r\nimport { defineConfig } from 'vite';\r\nimport monacoEditorPlugin from '@dvaji/vite-plugin-monaco-editor';\r\n\r\nexport default defineConfig({\r\n  plugins: [monacoEditorPlugin()],\r\n});\r\n```\r\n\r\n### Import all monaco functions\r\n\r\n- `index.ts`:\r\n\r\n```ts\r\nimport * as monaco from 'monaco-editor';\r\n\r\nmonaco.editor.create(document.getElementById('container'), {\r\n  value: 'console.log(\"Hello, world\")',\r\n  language: 'javascript',\r\n});\r\n```\r\n\r\n### Import part of monaco functions\r\n\r\nThe `import * as monaco from 'monaco-editor'` is import all features and languages of the Monaco Editor. Assume you only need part of the features and languages:\r\n\r\n- `customMonaco.ts`\r\n\r\n```ts\r\nimport 'monaco-editor/esm/vs/editor/editor.all.js';\r\nimport 'monaco-editor/esm/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js';\r\n\r\nimport * as monaco from 'monaco-editor/esm/vs/editor/editor.api';\r\n\r\nexport { monaco };\r\n```\r\n\r\nThe Complete list of imports: [customMonaco.ts](test/src/monaco/customMonaco.ts)\r\n\r\n- `index.ts`\r\n\r\n```ts\r\nimport { monaco } from './customMonaco.ts';\r\nmonaco.editor.create(document.getElementById('container'), {\r\n  value: 'console.log(\"Hello, world\")',\r\n  language: 'javascript',\r\n});\r\n```\r\n\r\n## Options\r\n\r\n- `languageWorkers` (`string[]`) - include only a subset of the languageWorkers supported.\r\n\r\n  - default value: ['editorWorkerService', 'css', 'html', 'json', 'typescript'].\r\n  - Assuming only use css worker(editorWorkerService is must include base worker), you can set ['editorWorkerService', 'css']\r\n\r\n- `customWorkers` (`IWorkerDefinition[]`) - include your custom worker.\r\n\r\n  - default value: []\r\n  - example value: `[{label: \"graphql\", entry: \"monaco-graphql/dist/graphql.worker\"}]`, The `entry` is relative path in the node_modules Or you can set absolute path.\r\n\r\n- `publicPath` (`string`) - custom public path for worker scripts, overrides the public path from which files generated by this plugin will be served. Or you can set CDN e.g `https://unpkg.com/@dvaji/vite-plugin-monaco-editor@2.0.0/cdn`\r\n\r\n  - default value: `monacoeditorwork`\r\n\r\n- `globalAPI` (`boolean`) - specifies whether the editor API should be exposed through a global `monaco` object or not. This option is applicable to `0.22.0` and newer version of `monaco-editor`. Since `0.22.0`, the ESM version of the monaco editor does no longer define a global `monaco` object unless `global.MonacoEnvironment = { globalAPI: true }` is set ([change log](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md#0220-29012021)).\r\n  - default value: `false`.\r\n- `customDistPath` (`(root: string, buildOutDir: string, base: string) => string`) - Custom callback returns the worker path\r\n- `forceBuildCDN` (`boolean`) - If you use CDN, the build is skipped by default. Set to true if you want to generate worker\r\n  - default value: `false`\r\n\r\nSome languages share the same web worker. If one of the following languages is included, you must also include the language responsible for instantiating their shared worker:\r\n\r\n| Language   | Instantiator |\r\n| ---------- | ------------ |\r\n| javascript | typescript   |\r\n| handlebars | html         |\r\n| scss, less | css          |\r\n","readmeFilename":"README.md","_rev":"1-1c42ded3e21c9e065e43403f736ba138"}