question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some examples are broken on Firefox due to module importing

See original GitHub issue

Some examples and example libraries use import * as THREE from 'three'; which not supported on Firefox. This results in the error Uncaught TypeError: Error resolving module specifier “three”. Relative module specifiers must start with “./”, “../” or “/”. on certain example pages such as https://threejs.org/examples/webgl_materials_standard_nodes.html and all the 7 webgpu_* examples.

I was able to fix this locally by switching to import * as THREE from '../build/three.module.js'; but this needs to be done for the example html files and also a bunch of JS like jsm/renderers/nodes/inputs/ColorNode.js.

The WebGPU examples are broken on FF Nightly for other reasons (I think FF is using an old version of the API but I’m not sure), so it might be OK to leave those with import maps for now. But should https://threejs.org/examples/webgl_materials_standard_nodes.html be fixed to keep FF support?

https://github.com/mrdoob/three.js/pull/21322 by @sunag and https://github.com/mrdoob/three.js/commit/66bd94b5ca1fc24e508d69342f737355eeb5e9d4 by @mrdoob are the problematic changes.

Broken browsers: FF public version 89.0 FF nightly version 92.0

Working browsers: Chrome

Three.js version: dev and 130

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Mugen87commented, Jul 15, 2021

webgl_materials_standard_nodes uses the new node material system similar to the WebGPU examples and thus import maps.

2reactions
gkjohnsoncommented, Jul 15, 2021

See mrdoob’s comment here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic module import doesn't work in webextension content ...
Our bundling tool implements code-splitting and uses dynamic imports for that. Works great in Chrome, but no way to adapt for Firefox.
Read more >
ES2015 import doesn't work (even at top-level) in Firefox
When I load the page in Firefox 46, it returns "SyntaxError: import declarations may only appear at top level of a module" -...
Read more >
Import error in Firefox dev mode #8621 - vitejs/vite - GitHub
Describe the bug in Dev mode only in Firefox browser. SyntaxError: import declarations may only appear at top level of a module ...
Read more >
Three.js import map not working in Firefox - Questions
Uncaught TypeError: Error resolving module specifier “three”. ... The import should still work like in the official examples.
Read more >
import declarations may only appear at top level of a module firefox ...
Following some basic tutorials I am able to create a script for the worker, create a worker and communicate with it. The problem...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found