vue-cropper icon indicating copy to clipboard operation
vue-cropper copied to clipboard

The requested module 'vue-cropper' is a CommonJS module

Open Alixhan opened this issue 1 year ago • 5 comments

Named export 'VueCropper' not found. The requested module 'vue-cropper' is a CommonJS module, which may not support all module.exports as named exports.

咱们这个库没有配置好ESM,可以参考一下 vitepress的问题 有个naive-ui库也是这个问题,已经解决了

Alixhan avatar Oct 25 '23 15:10 Alixhan

还有个错误, E:\my-workspace\xh-bms\xh-admin-frontend\node_modules\vue-cropper\dist\vue-cropper.es.js:1 import { defineComponent as M, openBlock as C, createElementBlock as x, withDirectives as O, createElementVNode as v, normalizeStyle as y, vShow as X, createCommentVNode as b, normalizeClass as S, toDisplayString as H } from "vue"; ^^^^^^

SyntaxError: Cannot use import statement outside a module

应该也是一样的问题,大佬修复一下。

Alixhan avatar Oct 25 '23 15:10 Alixhan

现在js越来越严格了,CommonJS和ESModule的导入最好不要混用,尤其是类库,如果用ES规范导入,文件扩展名用.mjs更好。

Alixhan avatar Oct 25 '23 15:10 Alixhan

ok 这个我可升级打包配置应该可以

xyxiao001 avatar Oct 26 '23 02:10 xyxiao001

@xyxiao001 感谢大佬

Alixhan avatar Oct 26 '23 02:10 Alixhan

这个问题还没有解决?使用的1.1.1版本打包还是存在这个问题

a1067111756 avatar Feb 21 '24 01:02 a1067111756