-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
importing Aframe breaks build #4038
Comments
simple jsfiddle w/ the |
This is working in the fiddle - did you find a solution? I'm having the same problem. |
Was ES6 module working before? |
In case this is helpful: I got this error when using the |
Scripts that have I'm not sure why this is the case, as according to this, "the script that registers [custom components] has to be loaded after the DOM is parsed". Related: #4242. |
The |
In other words: This line https://github.com/aframevr/aframe/blob/master/src/index.js#L81 needs to be executed before this line https://github.com/aframevr/aframe/blob/master/src/index.js#L64 . If it isn't, then uninitialized things are used when A-Frame components already exist in the DOM. |
Testing my theory, I got |
It seems that there's warnings all over the codebase that say that everything needs to be loaded before the DOM. However, with JS modules, that's not going to happen with a static html file. It seems that the idea of everything needing to be initialized before the DOM needs to be rethought. |
(A script tag with type="module" implies defer, as @mattrossman pointed out above.) |
A stack overflow thread that looks related.
|
Yes, that's the same issue. If anything is in the DOM when A-Frame is loaded, then problems happen. |
using the latest dist at https://github.com/aframevr/aframe/tree/master/dist
whenever I try to use es6 modules to import aframe:
import './aframe.min.js'
I get this error:
aframe.min.js:19685 Uncaught TypeError: systems[name] is not a constructor at HTMLElement.value (aframe.min.js:19685) at HTMLElement.value (aframe.min.js:19670) at HTMLElement.value (aframe.min.js:19603) at HTMLElement.wrappedMethod (aframe.min.js:18416) at module.exports.registerElement (aframe.min.js:18325) at Object.104.../../lib/three (aframe.min.js:19538) at o (aframe.min.js:1) at aframe.min.js:1 at Object.147.../package (aframe.min.js:22136) at o (aframe.min.js:1)
The text was updated successfully, but these errors were encountered: