Do source maps work for Chrome extensions?

后端 未结 4 650
一生所求
一生所求 2020-12-17 20:49

I\'m using the Closure compiler to create a Chrome extension and I\'d like to get source maps to work for debugging. I can get source maps to work just fine by pointing the

相关标签:
4条回答
  • 2020-12-17 21:12

    In the spirit of providing answers to questions resolved in comments, Chrome previously did not support the use of source maps in extensions but this was rectified as of Chrome 29.

    Thanks to the commenter, @w00kie who filed and tracked the bug on Chromium - if you wish to receive reputation for your helpful effort just post your own answer and I will delete this one.

    0 讨论(0)
  • 2020-12-17 21:19

    I know I'm incredibly late to the party, but Chrome DOES allow source maps. The problem you may be having is that it refuses to load the maps by default. This can be fixed by adding the map to the web_accessible_resources in your manifest.json file.

    0 讨论(0)
  • 2020-12-17 21:21

    Chrome supports an extension source maps out of the box. No need to have them inline or adding these to web_accessible_resources in your manifest.json file.

    Mapped files are allocated under "Content scripts" tab within "Sources" tab under Developer Tools.

    There is a source code of all enabled extensions, plus webpack:// files (if source maps are created with Webpack).

    It's also possible to find mapped files using Cmd + P.

    0 讨论(0)
  • 2020-12-17 21:27

    I had the same problem and after switching to inline source maps, everything worked fine.

    The reason is, that chrome extension only support inline source mpas

    so, when you use webpack, just add

    devtool: "inline-source-map"
    
    0 讨论(0)
提交回复
热议问题