无法让源映射在 Firefox 中工作



对于即将推出的python到JS编译器的即将到来的版本,添加了对ES6模块的支持。但是,我无法获得Sourcemaps在Firefox的工作,而在Chrome中它们可以完美地工作。我正在使用Firefox开发人员版59.0B13(64位(我的问题是(Python(sourceFiles在调试器的源窗格中未显示。以下文件都在同一目录中,并由Node.js http-server提供:

Python来源:

from itertools import chain
class SolarSystem:
    planets = [list (chain (planet, (index + 1,))) for index, planet in enumerate ((
        ('Mercury', 'hot', 2240),
        ('Venus', 'sulphurous', 6052),
        ('Earth', 'fertile', 6378),
        ('Mars', 'reddish', 3397),
        ('Jupiter', 'stormy', 71492),
        ('Saturn', 'ringed', 60268),
        ('Uranus', 'cold', 25559),
        ('Neptune', 'very cold', 24766) 
    ))]
    lines = (
        '{} is a {} planet',
        'The radius of {} is {} km',
        '{} is planet nr. {} counting from the sun'
    )
    def __init__ (self):
        self.lineIndex = 0
    def greet (self):
        self.planet = self.planets [int (Math.random () * len (self.planets))]
        document.getElementById ('greet') .innerHTML = 'Hello {}'.format (self.planet [0])
        self.explain ()
    def explain (self):
        document.getElementById ('explain').innerHTML = (
            self.lines [self.lineIndex] .format (self.planet [0], self.planet [self.lineIndex + 1])
        )
        self.lineIndex = (self.lineIndex + 1) % 3
solarSystem = SolarSystem ()

转到JS:

// Transcrypt'ed from Python, 2018-03-30 16:23:19
import {__envir__, __nest__, __init__, __get__, __getcm__, __getsm__, py_metatype, object, __class__, __pragma__, __call__, __kwargtrans__, __globals__, __super__, property, __setProperty__, assert, __merge__, dir, setattr, getattr, hasattr, delattr, __in__, __specialattrib__, len, __i__, __k__, __t__, float, int, bool, py_typeof, issubclass, isinstance, callable, repr, chr, ord, max, min, round, __jsUsePyNext__, __pyUseJsNext__, py_iter, py_next, __PyIterator__, __JsIterator__, py_reversed, zip, range, any, all, sum, enumerate, copy, deepcopy, list, tuple, set, bytearray, bytes, str, dict, __jsmod__, __mod__, __pow__, __neg__, __matmul__, __mul__, __truediv__, __floordiv__, __add__, __sub__, __lshift__, __rshift__, __or__, __xor__, __and__, __eq__, __ne__, __lt__, __le__, __gt__, __ge__, __imatmul__, __ipow__, __ijsmod__, __imod__, __imul__, __idiv__, __iadd__, __isub__, __ilshift__, __irshift__, __ior__, __ixor__, __iand__, __getitem__, __setitem__, __getslice__, __setslice__, BaseException, Exception, IterableError, StopIteration, ValueError, KeyError, AssertionError, NotImplementedError, IndexError, AttributeError, py_TypeError, Warning, UserWarning, DeprecationWarning, RuntimeWarning, __sort__, sorted, map, filter, divmod, __Terminal__, __terminal__, print} from './org.transcrypt.__runtime__.js';
var __name__ = '__main__';
import {chain} from './itertools.js';
export var SolarSystem =  __class__ ('SolarSystem', [object], {
    __module__: __name__,
    planets: (function () {
        var __accu0__ = [];
        for (var [index, planet] of enumerate (tuple ([tuple (['Mercury', 'hot', 2240]), tuple (['Venus', 'sulphurous', 6052]), tuple (['Earth', 'fertile', 6378]), tuple (['Mars', 'reddish', 3397]), tuple (['Jupiter', 'stormy', 71492]), tuple (['Saturn', 'ringed', 60268]), tuple (['Uranus', 'cold', 25559]), tuple (['Neptune', 'very cold', 24766])]))) {
            __accu0__.append (list (chain (planet, tuple ([index + 1]))));
        }
        return __accu0__;
    }) (),
    lines: tuple (['{} is a {} planet', 'The radius of {} is {} km', '{} is planet nr. {} counting from the sun']),
    get __init__ () {return __get__ (this, function (self) {
        self.lineIndex = 0;
    });},
    get greet () {return __get__ (this, function (self) {
        self.planet = self.planets [int (Math.random () * len (self.planets))];
        document.getElementById ('greet').innerHTML = 'Hello {}'.format (self.planet [0]);
        self.explain ();
    });},
    get explain () {return __get__ (this, function (self) {
        document.getElementById ('explain').innerHTML = self.lines [self.lineIndex].format (self.planet [0], self.planet [self.lineIndex + 1]);
        self.lineIndex = __mod__ (self.lineIndex + 1, 3);
    });}
});
export var solarSystem = SolarSystem ();
//# sourceMappingURL=hello.map

和地图:

{
    "version": 3,
    "file": "hello.js",
    "sources": [
        "hello.py"
    ],
    "mappings": "AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAWA;AAMA;AACA;AAAA;AAEA;AACA;AACA;AACA;AAAA;AAEA;AAEA;AAEA;AAAA;AAAA;AAEA;AAAA"
}

有人看到缺少什么?该页面在Firefox中看起来还不错。只有地图不起作用。

重新启动firefox帮助,尽管已经启用了Sourcemaps。不知道为什么...

相关内容

  • 没有找到相关文章

最新更新