Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在Vue3 + Typescript下,无法正常打包 #1018

Closed
inyscc opened this issue May 27, 2021 · 2 comments
Closed

在Vue3 + Typescript下,无法正常打包 #1018

inyscc opened this issue May 27, 2021 · 2 comments

Comments

@inyscc
Copy link

inyscc commented May 27, 2021

使用Vite2建的Vue3,Typescript项目里,开发时,可以正常使用 Vditor,一旦使用 yarn build打包项目,就会报错。

不过,在package.json里,删除vue-tsc --noEmit后,就可以打包了。

这是写的代码

<template>
  <div id="vditor"></div>
</template>

<script lang="ts" setup>
import { onMounted } from "vue";
import Vditor from "vditor";

ref: vditor = null as null | Vditor;

onMounted(() => {
  initVditor()
})

const initVditor = () => {
  vditor = new Vditor("vditor", {
      height: 360,
      toolbarConfig: {
          pin: true,
      },
      cache: {
          enable: false,
      },
      after: () => {
          if (vditor)
              vditor.setValue('hello, Vditor + Vue!')
      }
  });
}
</script>
<style>
@import url(vditor/dist/index.css);
</style>

这是报错截图

@inyscc
Copy link
Author

inyscc commented May 27, 2021

我瞎了,#1015的问题和我遇见的一样

@simon28082
Copy link

这个ref 为啥我写直接报错,ref: vditor = null as null | Vditor;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants