xyxiao001 / vue-cropper

A simple picture clipping plugin for vue
https://github.xyxiao.cn/vue-cropper/docs/vue3.html
MIT License
4.35k stars 705 forks source link

vue3 + ts + vite打包报错 #745

Open ZhangYC193 opened 1 year ago

ZhangYC193 commented 1 year ago

Rollup failed to resolve import "vue-cropper/dist/index.css" from "/builds/xxx/src/components/frontUser/components/vueCorpperError.ts"

Rollup failed to resolve import "vue-cropper" from "/builds/xxx/src/components/frontUser/components/changeAvatar.vue?vue&type=script&setup=true&lang.ts".

"vue": "^3.3.2", "vue-cropper": "^1.0.9" "vite": "^4.3.5", 本地调试没问题,本地打包也可以, ci打包就报这个错 加载不到包里的资源

xyxiao001 commented 1 year ago

我瞅瞅,vite 4.x打包是不是有点不同

ZhangYC193 commented 1 year ago

好。等待中

ZhangYC193 commented 1 year ago

老哥 有持续关注吗Q.Q

xyxiao001 commented 1 year ago

image 刚刚拉的新项目,dev 和 build 都可以

{
  "name": "cropper-test",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "serve": "vite preview"
  },
  "dependencies": {
    "vue": "^3.3.2",
    "vue-cropper": "^1.0.9"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^4.3.3",
    "vite": "4.3.5"
  }
}
NewNameArk commented 1 year ago

image 刚刚拉的新项目,dev 和 build 都可以

{
  "name": "cropper-test",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "serve": "vite preview"
  },
  "dependencies": {
    "vue": "^3.3.2",
    "vue-cropper": "^1.0.9"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^4.3.3",
    "vite": "4.3.5"
  }
}

请问加上 vue-tsc 试试哦