Vue: Compilation error after using Element Plus <script lang="ts" setup> and adding lang="ts"

When Xiaobai used element plus, an error occurred when he copied the official website code directly to the compiler. After checking the problem, he found that the problem lies in <script lang="ts" setup>, and element plus does not support the lang="ts" syntax.

Questions are as follows,

Module parse failed: The keyword "interface' is reserved (2:0)

The screenshot is shown below,

Insert image description here

After checking the information, I found a solution, which I will record here.

  • First install typescript ts-loader,
npm install -D typescript ts-loader
  • Then, follow this tutorial and you will be able to solve it.

https://blog.csdn.net/qq_61672548/article/details/125506231

Guess you like

Origin blog.csdn.net/yyyyyyyyyyy_9/article/details/132313350