Skip to content

Commit 0005ca1

Browse files
committed
refactor: simplify get import map
1 parent 6f56815 commit 0005ca1

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/output/Preview.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import srcdoc from './srcdoc.html?raw'
1414
import { PreviewProxy } from './PreviewProxy'
1515
import { compileModulesForPreview } from './moduleCompiler'
16-
import { Store, importMapFile } from '../store'
16+
import { Store } from '../store'
1717
import { Props } from '../Repl.vue'
1818
1919
const props = defineProps<{ show: boolean; ssr: boolean }>()
@@ -36,14 +36,9 @@ onMounted(createSandbox)
3636
3737
// reset sandbox when import map changes
3838
watch(
39-
() => store.state.files[importMapFile].code,
40-
(raw) => {
39+
() => store.getImportMap(),
40+
() => {
4141
try {
42-
const map = JSON.parse(raw)
43-
if (!map.imports) {
44-
store.state.errors = [`import-map.json is missing "imports" field.`]
45-
return
46-
}
4742
createSandbox()
4843
} catch (e: any) {
4944
store.state.errors = [e as Error]

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"removeComments": false,
1717
"lib": ["esnext", "dom"],
1818
"jsx": "preserve",
19-
"rootDir": "."
19+
"rootDir": ".",
20+
"skipLibCheck": true
2021
},
2122
"include": ["src", "test", "vite.config.ts"]
2223
}

0 commit comments

Comments
 (0)