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

[webpack] 第2021天 在webpack中,如何配置生成Source Map? #5987

Open
haizhilin2013 opened this issue Oct 26, 2024 · 1 comment
Open
Labels

Comments

@haizhilin2013
Copy link
Collaborator

第2021天 在webpack中,如何配置生成Source Map?

3+1官网

我也要出题

@WILLwings7092
Copy link

  1. 首先简单介绍下Source Map是什么以及作用:
    Source Map 是一种映射关系文件,记录了转换后的代码与原始源代码之间的对应关系,方便我们调试以及错误定位。
    这种对应关系越具体,越会影响构建性能,所以配置它的目的是寻求错误信息与性能的平衡。
  2. 可以通过 Devtool 来配置(官网文档 https://webpack.js.org/configuration/devtool/)
  • eval:最快的 Source Map 方式,但提供的信息最少
  • cheap-module-source-map 提供行级别的映射,但不包括列信息,适合生产环境
  • source-map 提供最详细的映射信息,但构建时间较长,适合开发环境

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants