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

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

Open
Alixhan opened this issue Oct 25, 2023 · 5 comments
Open

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

Alixhan opened this issue Oct 25, 2023 · 5 comments

Comments

@Alixhan
Copy link

Alixhan commented Oct 25, 2023

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
Copy link
Author

Alixhan commented Oct 25, 2023

还有个错误,
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
Copy link
Author

Alixhan commented Oct 25, 2023

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

@xyxiao001
Copy link
Owner

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

@Alixhan
Copy link
Author

Alixhan commented Oct 26, 2023

@xyxiao001 感谢大佬

@a1067111756
Copy link

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

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

3 participants