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

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

Open
huxiaofeng1983 opened this issue Jul 24, 2024 · 6 comments
Open

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

huxiaofeng1983 opened this issue Jul 24, 2024 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@huxiaofeng1983
Copy link

启动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
Copy link
Owner

imzbf commented Jul 25, 2024

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

@huxiaofeng1983
Copy link
Author

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

@imzbf
Copy link
Owner

imzbf commented Jul 29, 2024

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

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

@huxiaofeng1983
Copy link
Author

不行,好像不能这么配置,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
Copy link
Owner

imzbf commented Jul 29, 2024

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

@huxiaofeng1983
Copy link
Author

谢谢大佬的耐心回复!

@imzbf imzbf added the help wanted Extra attention is needed label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants