imzbf / md-editor-extension

Common extensions for md-editor-v3 and md-editor-rt.
MIT License
27 stars 11 forks source link

Nuxt 3.12 使用这个扩展报错 #35

Open huxiaofeng1983 opened 1 month ago

huxiaofeng1983 commented 1 month ago

启动nuxt会报以下错误: WARN Failed to load source map for /ssr-project/node_modules/html2pdf.js/dist/html2pdf.js. 22:54:15 Error: An error occurred while trying to read the map file at es6-promise.map Error: ENOENT: no such file or directory, open '/ssr-project/node_modules/html2pdf.js/dist/es6-promise.map'

imzbf commented 1 month ago

取消生成source map试试,这个组件没有提供source map

huxiaofeng1983 commented 1 month ago

不知道怎样取消,在网上查了好几种配置方法都不管用,刚接触 nuxt,只是为了ssr,太麻烦了

imzbf commented 1 month ago

你可以考虑这样做,在 nuxt.config.js 文件中,添加或修改 build 配置对象,并设置 transpile 选项中的 sourceMap 属性为 false(对于生产环境)。

export default {
  // ...
  build: {
    transpile: {
      // Disable source maps for production builds
      sourceMap: process.env.NODE_ENV !== 'production',
    },
  },
  // ...
}
huxiaofeng1983 commented 1 month ago

不行,好像不能这么配置,IDE报错:Vue: Object literal may only specify known properties, and sourceMap does not exist in type 官方文档说类型为数组:https://nuxt.com/docs/api/nuxt-config#transpile

imzbf commented 1 month ago

这个问题保留一段时间,看有其他使用nuxt的伙伴有了解这类问题的能否提供帮助

huxiaofeng1983 commented 1 month ago

谢谢大佬的耐心回复!