Skip to content

使用 ElMessage 会导致 sourcemap 的位置不对 #177

Description

@xuxchao

复现步骤:

  1. 创建一个 vite 初始化的 vue 项目。配置和 App.vue 代码如下。
  2. 启动项目,单击进入会发现 console.log 打印的代码位置是有问题的。

image

期望能够识别到正确的位置
App.vue

<template>
  <div @click="tapSdk">进入</div>
</template>
<script setup lang="ts">
import { ElMessage } from "element-plus";

const tapSdk = async () => {
  console.log("xxx");
  ElMessage.error("xxx");
};
</script>

vite.config.ts

import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";

import ElementPlus from "unplugin-element-plus/vite";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), vueJsx(), ElementPlus()],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions