File tree 1 file changed +17
-2
lines changed
packages/sfc-playground/src
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
import Header from ' ./Header.vue'
3
3
import { Repl , ReplStore , SFCOptions } from ' @vue/repl'
4
- import Monaco from ' @vue/repl/monaco-editor'
4
+ import type Monaco from ' @vue/repl/monaco-editor'
5
+ import type CodeMirror from ' @vue/repl/codemirror-editor'
5
6
import { ref , watchEffect , onMounted } from ' vue'
7
+ import { shallowRef } from ' vue'
8
+
9
+ const EditorComponent = shallowRef <typeof Monaco | typeof CodeMirror >()
10
+
11
+ if (import .meta .env .DEV ) {
12
+ import (' @vue/repl/codemirror-editor' ).then (
13
+ mod => (EditorComponent .value = mod .default )
14
+ )
15
+ } else {
16
+ import (' @vue/repl/monaco-editor' ).then (
17
+ mod => (EditorComponent .value = mod .default )
18
+ )
19
+ }
6
20
7
21
const setVH = () => {
8
22
document .documentElement .style .setProperty (' --vh' , window .innerHeight + ` px ` )
@@ -97,8 +111,9 @@ onMounted(() => {
97
111
@toggle-ssr =" toggleSSR"
98
112
/>
99
113
<Repl
114
+ v-if =" EditorComponent"
100
115
:theme =" theme"
101
- :editor =" Monaco "
116
+ :editor =" EditorComponent "
102
117
@keydown.ctrl.s.prevent
103
118
@keydown.meta.s.prevent
104
119
:ssr =" useSSRMode"
You can’t perform that action at this time.
0 commit comments