Import not working in meteor Package


#1

I am creating a package with the folder structure as below:

packages
|- testpackage
   |- client
      |- packagetest.js
   |- imports
      |- ui
         |- temp.html
   |- package.js 

Getting error when I use
import '../imports/ui/temp.html'

Error is NPM module not found
I have tried with other combinations as well.
I want to use templates in my temp.html in main project


#2

Does anyone have any suggestion regarding import in meteor packages? Any help will be appreciated.


#3

Where are you calling ../imports/ui/temp.html' from?


#4

I am calling it from client/packagetest.js of same package.


#5

Have you added

api.versionsFrom('METEOR@1.3.2.4');
api.use(["modules", "ecmascript"]);

in your package.js?


#6

I had added
api.versionsFrom('1.3.2.4');

and both modules and ecmascript


#7

I have added both of them but its not working. It is not eagerly loading js files from import folder but I can not import them either in same package.


#8

Thanks tcastelli, it’s working fine now with the same way. I had mistakenly removed … in front of imports