Does the server have access to the /imports directory? Having trouble running external JS plugins from imports folder

So, I’m trying to add some external JS files for my theme to my React Meteor app, but I have several issues.

First of all, when I place the JS files inside the /imports directory, I get a host of errors for my JS files, like ReferenceError: window is not defined or ReferenceError: jQuery is not defined. That tells me that the code is run server side. Wrapping the code in (Meteor.isClient){} doesn’t provide a solution.

Then, when I place these scripts inside /client directory, I’m not able to import modules from /client to /imports for some reason. There’s always a Error: cannot find module error, even though the path is correct.

Anyone have any idea what’s going on? I’ve been using Meteor for over a year already and still confused at this new modular design.

Hi,

Use old style pre 1.3 meteor, dont use the import folder

Put non meteor js files in the

Root/client/compatibility folder

Look how simple-todos example app is built, that should give you some idea on how to structure your app and import code on both client and server. Or check out todos app for a more complex example.

Thanks. This worked. Placing the JS in the client file stopped giving me the error on server.

So now, my entire project is in the client folder like it usually is, while my API declarations are all in the import folder.