Import not working in meteor Package

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

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

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

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

Have you added

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

in your package.js?

1 Like

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

and both modules and ecmascript

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.

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