admin管理员组文章数量:1410712
I'm working on a JavaScript game and it works as intended in Chrome and Safari. However, in Firefox, the page doesn't load any scripts, and the debugger is empty. I'm not seeing any errors at all. This is the entirety of the html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<canvas id="canvas"></canvas>
<script type="module" src="foo.js"></script>
<script type="module" src="bar.js"></script>
<script type="module" src="baz.js"></script>
<script type="module" src="qux.js"></script>
<script type="module" src="foobar.js"></script>
<script type="module" src="bazqux.js"></script>
</body>
</html>
UPDATE: Some added context for future readers: per Roko C. Buljan's answer, it turns out ES6 modules are not on by default in FireFox at the time of writing. That was the issue.
I'm working on a JavaScript game and it works as intended in Chrome and Safari. However, in Firefox, the page doesn't load any scripts, and the debugger is empty. I'm not seeing any errors at all. This is the entirety of the html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<canvas id="canvas"></canvas>
<script type="module" src="foo.js"></script>
<script type="module" src="bar.js"></script>
<script type="module" src="baz.js"></script>
<script type="module" src="qux.js"></script>
<script type="module" src="foobar.js"></script>
<script type="module" src="bazqux.js"></script>
</body>
</html>
UPDATE: Some added context for future readers: per Roko C. Buljan's answer, it turns out ES6 modules are not on by default in FireFox at the time of writing. That was the issue.
Share Improve this question edited Jan 12, 2018 at 0:57 PopKernel asked Jan 11, 2018 at 23:31 PopKernelPopKernel 4,2707 gold badges33 silver badges55 bronze badges 02 Answers
Reset to default 6You're using module
features not openly available in Firefox. To enable them you could go to about:config
and enable them under dom.moduleScripts.enabled
setting its Value to true
Meanwhile you could use a polyfill like this or use build tools that will pile your modules into a single ES5-backed production-ready file.
Some indepth readings:
https://html.spec.whatwg/multipage/webappapis.html#integration-with-the-javascript-module-system
https://developer.mozilla/en-US/docs/Web/HTML/Element/script
https://jakearchibald./2017/es-modules-in-browsers/
https://medium./webpack/the-state-of-javascript-modules-4636d1774358
In my case, I needed to go to about:config
, reset the devtools.debugger.project-directory-root-name
setting to default and set devtools.debugger.project-directory-root
value to top-level
.
The problem was that I was using the "Set directory root" function on one of the sites. Firefox made it impossible (hint, please, if this is not true) to get back from this wonderful mode without going to the same site or fixing the variables associated with this mode manually.
本文标签: javascriptFirefox this page has no sourcesStack Overflow
版权声明:本文标题:javascript - Firefox this page has no sources - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744254874a2597429.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论