简体   繁体   中英

Why do dependency problems cause javascript code not to run properly when within a Meteor project?

I have been trying to port HTML5 with js code into Meteor. I'm having Javascript dependency problems.

The code can be found at: https://github.com/cwilso/Audio-Input-Effects

I created a new basically empty meteor project (which runs fine) and then added all of the js files from the repo above (which also runs fine on its own).

In order to make sure that the load order was correct, I renamed all the js files using numeric prefixes so that they would definitely be in the same order that they are loaded in the github repo. Looking forward to Meteor coming up with a better solution to this particular issue. I made a local copy of one js file that was otherwise loaded from a url in the repo.

In order to try to initialize the js I also added a file hello.js: if (Meteor.isClient) {

  Meteor.startup(function () {
    // code to run on server at startup
    initAudio;
  });
}

When meteor runs and I look in the console, I get the following errors:

Uncaught TypeError: o3djs.provide is not a function (120_shader.js)
Uncaught ReferenceError: initAudio is not defined (hello.js)
Uncaught ReferenceError: Matrix4x4 is not defined (110_visualizer.js)

Thank you for your help.

通过将所有js源文件以正确的顺序放入单个js文件中,我能够解决此问题。

Anybody still wanting information regarding meteor load order, Scotch.io wrote an update to the official docs which clears it up somewhat.

https://github.com/meteor/meteor/commit/a5bdf481dfece9ebc57107d71be478f9b48cbd1e

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM