Chrome扩展程序:未加载源地图 [英] Chrome Extension: Not loading source-maps
问题描述
由于某种原因,我无法在Chrome扩展程序中加载源地图.
I am not able to load sourcemap in Chrome Extension for some reason.
要为Chrome扩展程序加载的文件夹在.js
文件旁边具有.map
. .js
文件的第//# sourceMappingURL=1.9215106f1980d05d2b4c.js.map
行引用了.map文件路径.
The folder which is being loaded for Chrome Extension has .map
just next to .js
file. With the .js
file having the line //# sourceMappingURL=1.9215106f1980d05d2b4c.js.map
referencing the .map file path.
但是,由于某些原因,Chrome开发者工具无法加载地图.
However, the Chrome dev-tools is not loading the maps for some reason.
我再次检查了Chrome设置,以确保js源地图已打开并且正在使用简单的Angular项目.
I double checked the Chrome settings to make sure that the js source maps is turned on and it is working with a simple Angular project.
此外,请确保清单文件中包含以下内容:
Also, made sure I have the following in the manifest file:
"web_accessible_resources":[
"*.map"
],
推荐答案
在webpack.config.js中设置以下属性对我有用:
Setting the following property in webpack.config.js worked for me:
module.exports = {
//Configuration parameters
devtool: 'eval-source-map',
//Other configuration parameters
}
您还必须更新manifest.json以允许eval
:
You'll also have to update manifest.json to allow eval
:
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
devTool样式列表: https://webpack.js.org/configuration/devtool/#devtool
List of devTool styles: https://webpack.js.org/configuration/devtool/#devtool
webpack.config.js解释: https://webpack.js.org/configuration/
webpack.config.js explained: https://webpack.js.org/configuration/
这篇关于Chrome扩展程序:未加载源地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!