2

我正在开发 Python 到 JavaScript 编译器,并尝试实现 V3 源映射。

以下格式可以正常工作:

{
    "version": 3,
    "file": "D:/activ_tosh/geatec/transcrypt/transcrypt/demos/pong/__javascript__/pong.mod.js",
    "sources": [
        "D'!activ_tosh!geatec!transcrypt!transcrypt!demos!pong!pong.py"
    ],
    "mappings": "AAAA;AAIA;AAEA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AAEA;AAAA;AAEA;AACA;AACA;AACA;AAEA;AAAA;AACA;AAEA;AAAA;AACA;AAEA;AAAA;AACA;AAEA;AAAA;AACA;AAAA;AAAA;AAEA;AAAA;AAEA;AACA;AACA;AAEA;AAAA;AACA;AAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AAAA;AAGA;AACA;AAEA;AAAA;AACA;AACA;AAEA;AAAA;AACA;AAAA;AAAA;AAEA;AAAA;AAOA;AACA;AAEA;AAAA;AACA;AAMA;AAAA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AAEA;AAAA;AAEA;AAGA;AAQA;AACA;AACA;AAAA;AAAA;AAAA;AA/CA;AACA;AACA;AACA;AA8CA;AAAA;AAKA;AAEA;AAAA;AACA;AAMA;AAMA;AAAA;AACA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAEA;AAAA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAvCA;AACA;AAwCA;AAAA;AAKA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAHA;AAAA;AAAA;AAAA;AAKA;AAKA;AAOA;AAAA;AACA;AAEA;AAAA;AACA;AACA;AAEA;AAAA;AACA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAHA;AAAA;AAAA;AAAA;AAKA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAvCA;AACA;AAwCA;AAAA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;AAAA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AAAA;AAEA;AACA;AAEA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAEA;AAAA;AACA;AAEA;AAAA;AACA;AAEA;AAAA;AACA;AAEA;AAAA;AACA;AAEA;AAAA;AACA;AAEA;AAAA;AACA;AAEA;AAAA;AACA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA"
}

但是所谓的“索引图”格式在 Chrome 中会出现错误:

Failed to parse SourceMap

我到处找例子,但找不到。谁能发现可能是什么问题,我的索引图是:

{
    "version": 3,
    "file": "D:/activ_tosh/geatec/transcrypt/transcrypt/demos/pong/__javascript__/pong.js",
    "sections": [
        {
            "offset": {
                "line": 15928,
                "column": 0
            },
            "url": "file:///D:/activ_tosh/geatec/transcrypt/transcrypt/demos/pong/__javascript__/extra/sourcemap/pong.mod.js.map"
        }
    ]
}

我已经尝试过使用和不使用'file:///'以及相对路径,但是这个(非常无信息的)错误仍然存​​在。我也尝试过 Firefox devtools,但它们根本没有给出错误信息。

4

0 回答 0