Working out why a file is being imported to the client

I have a lot of files in my imports/api directory that should only be available on the server, but are being imported to the client. I can’t work out why. I’ve searched my project for imports from a client side file and I can’t find one.

Any ideas how to solve this issue?

They must be imported somewhere for them to appear (unless you’re using an older version of meteor). I’d try adding a new file and see if it get bundled to just confirm that it’s not a broken meteor install (happens sometimes).

Otherwise you could separate code in /imports/**/server and /imports/**/client. Meteor will refuse to bundle any files (and subfolders) in a folder named server to the client and vice versa, regardless of if they’re in an imports folder or not.

Thanks for that info. I may use the folder trick to be sure files dont go where theyre not supposed to be. Will look into the issue more and see if I am mistakenly importing somewhere

So it’s a little strange. I’m not seeing the server files in the production build, but I am seeing them locally. Not sure what’s going on. Could it be a broken locally? But it also happens on another devs local computer. So not sure how that happened.