# repl
**Repository Path**: vuejs/repl
## Basic Information
- **Project Name**: repl
- **Description**: Vue SFC REPL as a Vue 3 component
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 3
- **Forks**: 2
- **Created**: 2022-08-03
- **Last Updated**: 2026-04-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# @vue/repl
Vue SFC REPL as a Vue 3 component.
## Basic Usage
**Note: `@vue/repl` >= 2 now supports Monaco Editor, but also requires explicitly passing in the editor to be used for tree-shaking.**
```ts
// vite.config.ts
import { defineConfig } from 'vite'
export default defineConfig({
optimizeDeps: {
exclude: ['@vue/repl'],
},
// ...
})
```
### With CodeMirror Editor
Basic editing experience with no intellisense. Lighter weight, fewer network requests, better for embedding use cases.
```vue
```
### With Monaco Editor
With Volar support, autocomplete, type inference, and semantic highlighting. Heavier bundle, loads dts files from CDN, better for standalone use cases.
```vue
```
## Advanced Usage
Customize the behavior of the REPL by manually initializing the store.
See [v4 Migration Guide](https://github.com/vuejs/repl/releases/tag/v4.0.0)
```vue
```
Use only the Preview without the editor
```vue
```
Configuration options for resource links. (replace CDN resources)
```ts
export type ResourceLinkConfigs = {
/** URL for ES Module Shims. */
esModuleShims?: string
/** Function that generates the Vue compiler URL based on the version. */
vueCompilerUrl?: (version: string) => string
/** Function that generates the TypeScript library URL based on the version. */
typescriptLib?: (version: string) => string
/** [monaco] Function that generates a URL to fetch the latest version of a package. */
pkgLatestVersionUrl?: (pkgName: string) => string
/** [monaco] Function that generates a URL to browse a package directory. */
pkgDirUrl?: (pkgName: string, pkgVersion: string, pkgPath: string) => string
/** [monaco] Function that generates a URL to fetch the content of a file from a package. */
pkgFileTextUrl?: (
pkgName: string,
pkgVersion: string | undefined,
pkgPath: string,
) => string
}
```
**unpkg**
```ts
const store = useStore({
resourceLinks: ref({
esModuleShims:
'https://unpkg.com/es-module-shims@1.5.18/dist/es-module-shims.wasm.js',
vueCompilerUrl: (version) =>
`https://unpkg.com/@vue/compiler-sfc@${version}/dist/compiler-sfc.esm-browser.js`,
typescriptLib: (version) =>
`https://unpkg.com/typescript@${version}/lib/typescript.js`,
pkgLatestVersionUrl: (pkgName) =>
`https://unpkg.com/${pkgName}@latest/package.json`,
pkgDirUrl: (pkgName, pkgVersion, pkgPath) =>
`https://unpkg.com/${pkgName}@${pkgVersion}/${pkgPath}/?meta`,
pkgFileTextUrl: (pkgName, pkgVersion, pkgPath) =>
`https://unpkg.com/${pkgName}@${pkgVersion || 'latest'}/${pkgPath}`,
}),
})
```
**npmmirror**
```ts
const store = useStore({
resourceLinks: ref({
esModuleShims:
'https://registry.npmmirror.com/es-module-shims/1.5.18/files/dist/es-module-shims.wasm.js',
vueCompilerUrl: (version) =>
`https://registry.npmmirror.com/@vue/compiler-sfc/${version}/files/dist/compiler-sfc.esm-browser.js`,
typescriptLib: (version) =>
`https://registry.npmmirror.com/typescript/${version}/files/lib/typescript.js`,
pkgLatestVersionUrl: (pkgName) =>
`https://registry.npmmirror.com/${pkgName}/latest/files/package.json`,
pkgDirUrl: (pkgName, pkgVersion, pkgPath) =>
`https://registry.npmmirror.com/${pkgName}/${pkgVersion}/files/${pkgPath}/?meta`,
pkgFileTextUrl: (pkgName, pkgVersion, pkgPath) =>
`https://registry.npmmirror.com/${pkgName}/${pkgVersion || 'latest'}/files/${pkgPath}`,
}),
})
```