Meteor client side require


#1

Hello guys,

What is difference between require(StringPath) and require(variable)

I have some problem:
For example:
require '../../ui/pages/main.coffee' it works
But
path = '../../ui/pages/main.coffee'
require path
Doesn’t work, and I get console error
Error: Cannot find module '../../ui/pages/main.coffee'

What’s going on ?


#2

If you don’t set a static string in your require, the meteor compiler will not know that your file needs to be included in your app (especially if it is in an imports directory).


#3

Thx you, you are right! I learned the import source