Package dependency


#1

For my project growing, I would like separate my code in packages. I did some test, and my code didn’t respond at all. So I tried to do a new project with a “meteor create newProject”, I tried the counter code who were working nicely, I tried to put all the working code in a folder packages like that :

/myProject
---/.meteor
---/packages
------/myApp1
---------/client
------------myApp.css
------------myApp.html
------------myApp.js
---------/server
------------myApp.js
---main.html

I changed the myApp.html code to encapsulate it in a template like that :

<template name="packageProjectMyApp1">
    <h1>Welcome in myApp1 !</h1>
    {{> hello}}
    {{> info}}
</template>

And my main.html like that :

<p>hello world from main.html</p>
{{> packageProjectMyApp1}}

In the package.js in my packages folder, I added this :

Package.describe({
    name: 'pierre:myapp1',
    version: '0.0.1',
    summary: 'My App1 Project',
});

Package.onUse(function(api) {
    api.versionsFrom(['METEOR@1.0', 'METEOR@1.3']);
    api.use("templating", "client");
    api.use("reactive-var", "client");
    api.use(['jquery'], 'client', {weak: true});
    api.addFiles('client/myApp.html', 'client');
});

And In my .meteor/packages I obviously add : pierre:myapp1

But When I click on my button, nothing happened…
What I did wrong ?!
Is that a problem of api.use ? Even when I placing a breakpoint in my button’s click event, I don’t pass in :frowning:


#2

Try adding all of your packages files using api.addFiles. So something like:

...
Package.onUse(function(api) {
  ...
  api.addFiles([
    'client/myApp.css',
    'client/myApp.html',
    'client/myApp.js',
  ], 'client');
});
...

#3

Thanks Hwillson.
Wow… was really noobish as fuck ! :frowning: Sorry for that !
It works well, but my breakpoint is webstorm did’nt triggered. Is it normal and I have to debug package from another way ? Or is there a solution to debug package in webstorm ?


#4

I don’t use WebStorm, so I’m not much help here - maybe someone else can chime in with WebStorm + debugging specifics.


#5

For those who would like an answer : In webstorm before the main version 11 you have to put independently each file in your run configuration javascript debug. But hopefully in the new webstorm version it works like a charm natively.