【问题标题】:Visual Studio 2015 Unsupported format of the sourcemapVisual Studio 2015 不支持的源映射格式
【发布时间】:2015-07-29 23:25:55
【问题描述】:

我正在尝试调试 JavaScript 源文件。但无法调试。断点未按预期工作。

我正在使用 grunt 来连接和缩小文件。 Sourcemap 也会生成。

我尝试使用 f12 在 chrome 中直接调试:工作 我尝试使用 f12 在 ie11 中直接调试:工作 但在 Visual Studio 2015 JavaScript 调试中失败。

不支持的源地图格式

进一步调查,我在即时窗口中看到了上述行。

所以尝试评论以下行

//# sourceMappingURL=Country.js.map

错误消失了。显然这不是解决办法,但我这样做是为了缩小问题范围。

我的 gruntfile.js

module.exports = function (grunt) {
// load Grunt plugins from NPM
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');

// configure plugins
grunt.initConfig({
    uglify: {
        country: {
            options: {
                sourceMap: true,
                sourceMapName: 'wwwroot/Scripts/Country.js.map'
            },
            files: { 'wwwroot/Scripts/Country.js': ['wwwroot/Scripts/Source/**/Country*.js'] }
        },
        cities: {
            options: {
                sourceMap: true,
                sourceMapName: 'wwwroot/Scripts/City.js.map'
            },
            files: { 'wwwroot/Scripts/City.js': ['wwwroot/Scripts/Source/**/City*.js'] }
        }
    },

    watch: {
        scripts: {
            files: ['wwwroot/Scripts/Source/**/*.js'],
            tasks: ['uglify']
        }
    }
});

// define tasks
grunt.registerTask('default', ['uglify', 'watch']);};

我的文件夹结构

查看附件图片以查看我的脚本和设置。

我尝试花费 3 多个小时来缩小问题范围。如果我解决了这个问题,我肯定会在这里更新。我尝试在谷歌上搜索“所有可能性”一词“不支持的源映射格式” “Visual Studio”源图调试 JavaScript。

【问题讨论】:

    标签: javascript debugging visual-studio-2015 source-maps


    【解决方案1】:

    问题仍然没有解决。但我的目标是从 Visual Studio 2015 进行调试。

    我没有调试缩小的文件,而是使用环境标签助手来渲染源 Javascript,而不进行缩小。

    它可能不是原始问题的答案,但它是否有助于任何寻找调试方法的人。那么这可能是一个更好的选择。

    <environment names="Development">
        @section headscripts {
            <script src="~/Scripts/Source/AngularApps/CountryManager.js"></script>
            <script src="~/Scripts/Source/Controllers/CountryController.js"></script>
            <script src="~/Scripts/Source/Services/CountryService.js"></script>
        }
    </environment>
    <environment names="Staging,Production">
        @section headscripts {
    
            <script src="~/Scripts/Country.min.js"></script>
        }
    </environment>
    

    【讨论】:

      猜你喜欢
      • 2016-06-05
      • 2018-06-02
      • 2017-02-09
      • 2017-03-12
      • 1970-01-01
      • 2015-10-17
      • 2015-11-29
      • 1970-01-01
      • 2022-07-22
      相关资源
      最近更新 更多