Skip to content

Commit

Permalink
fix: 🐛 use ES6 async import
Browse files Browse the repository at this point in the history
  • Loading branch information
AngeloSchulerPiletti committed Nov 15, 2023
1 parent 7f26206 commit e2679ad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/runtime/components/ExcalidrawBoard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref } from 'vue'
import ExcalidrawDefault from '@excalidraw/excalidraw'
import React from 'react'
import { type Root, createRoot } from 'react-dom/client'
import type { Ref } from 'vue'
Expand All @@ -16,12 +15,14 @@ let root: null | Root = null
onMounted(async () => {
if (excalidrawRef.value) {
root = createRoot(excalidrawRef.value)
let _Excalidraw: any
if (ExcalidrawDefault) {
_Excalidraw = ExcalidrawDefault
const Excalidraw = await import('@excalidraw/excalidraw')
if (Excalidraw.default) {
_Excalidraw = Excalidraw.default
}
else {
const Excalidraw = await import('@excalidraw/excalidraw')
_Excalidraw = Excalidraw.Excalidraw
}
Expand Down

0 comments on commit e2679ad

Please sign in to comment.