IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    无法从非 EcmaScript 模块导入命名导出

    子舒的博客发表于 2024-02-23 00:00:00
    love 0
    https://github.com/markdown-it/markdown-it markdown-it 是一个基于 vue 的解析 markdown 语法的库。 在 vue 中引入 markdown-it 模块时遇到一个问题,dev 开发运行时报出以下错误,无法从非 EcmaScript 模块导入命名导出。 # shell error in ./node_modules/markdown-it/lib/common/utils.mjs Can't import the named export 'P' from non EcmaScript module (only default export is available) error in ./node_modules/markdown-it/lib/index.mjs Can't import the named export 'decode' from non EcmaScript module (only default export is available) error in ./node_modules/markdown-it/lib/index.mjs Can't import the named export 'decode' from non EcmaScript module (only default export is available) error in ./node_modules/markdown-it/lib/common/utils.mjs Can't import the named export 'decodeHTML' from non EcmaScript module (only default export is available) error in ./node_modules/markdown-it/lib/rules_inline/entity.mjs Can't import the named export 'decodeHTML' from non EcmaScript module (only default export is available) error in ./node_modules/markdown-it/lib/index.mjs Can't import the named export 'encode' from non EcmaScript module (only default export is available) error in ./node_modules/markdown-it/lib/index.mjs Can't import the named export 'format' from non EcmaScript module (only default export is available) error in ./node_modules/markdown-it/lib/index.mjs Can't import the named export 'format' from non EcmaScript module (only default export is available) error in ./node_modules/markdown-it/lib/index.mjs Can't import the named export 'parse' from non EcmaScript module (only default export is available) error in ./node_modules/markdown-it/lib/index.mjs Can't import the named export 'parse' from non EcmaScript module (only default export is available) 导致 import 该库出现错误,解决方案需要修改 vue.config.js // vue.config.js module.exports = { configureWebpack: { module: { rules: [{ test: /\.mjs$/, include: /node_modules/, type: "javascript/auto" }] } }, }; 参考文献:https://github.com/vuejs/pinia/issues/675


沪ICP备19023445号-2号
友情链接