XiaoDaiGua-Ray / vue3-next-qrcode

MIT License
10 stars 1 forks source link

nuxt3 引用报错 #2

Open wmy94827 opened 3 months ago

wmy94827 commented 3 months ago

When set to "module", the type field allows a package to specify all .js files within are ES modules. If the "type" field is omitted or set to "commonjs", all .js files are treated as CommonJS.

XiaoDaiGua-Ray commented 3 months ago

你好,这边能给一个错误截图或者最小的复现吗?

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: shari @.> 发送时间: 2024年4月1日 14:23 收件人: XiaoDaiGua-Ray/vue3-next-qrcode @.> 抄送: Subscribed @.***> 主题: Re: [XiaoDaiGua-Ray/vue3-next-qrcode] nuxt3 引用报错 (Issue #2)

When set to "module", the type field allows a package to specify all .js files within are ES modules. If the "type" field is omitted or set to "commonjs", all .js files are treated as CommonJS.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Zerolouis commented 1 month ago

nuxt3构建时ESM兼容性问题,在nuxt.config.ts中禁用该模块的导入可以临时解决

export default defineNuxtConfig({
  build: {
      transpile: ['vue3-next-qrcode']
    },
})

有关解决该问题的文档: 官方:https://nuxt.com/docs/guide/concepts/esm#library-author-guide 中文:https://nuxt.com.cn/docs/guide/concepts/esm#%E5%BA%93%E4%BD%9C%E8%80%85%E6%8C%87%E5%8D%97

XiaoDaiGua-Ray commented 1 month ago

@Zerolouis 感谢你的反馈,这边在下一个版本会解决该问题,请关注版本变更