Nuxt Monaco Editor
Integrate monaco-editor with Nuxt
Install
npx nuxi@latest module add nuxt-monaco-editor
Don't forget to install monaco-editor.
Setup
- Add this module to the Nuxt config
export default defineNuxtConfig({
modules: ["nuxt-monaco-editor"],
});
- (Optional) Configure the module
export default defineNuxtConfig({
monacoEditor: {
// These are default values:
locale: "en",
componentName: {
codeEditor: "MonacoEditor",
diffEditor: "MonacoDiffEditor",
},
},
});
- Use the component in your pages or components
<template>
<MonacoEditor v-model="value" lang="typescript" />
</template>
<script lang="ts" setup>
const value = ref("");
</script>
Development
- Run
git submodule update --init --recursive. - Run
pnpm dev:prepareto generate type stubs. - Use
pnpm devto start playground in development mode. - Run
pnpm exec playwright-core install --with-depsto install dependencies for testing. - Run
pnpm testto run tests. - Run
pnpm lintto run linting.