Code inside package.js


is it possible to load package assets based on logic other than client,server? My package provides different css for desktop and mobile. If I api.addFiles them both the files would be added to the application. If I don’t addFiles them, I can’t access the files in the package.

How is it possible to provide assets that are not automatically added to the application?


if you only want to export the file on the server (or the client), you can pass in the second argument (e.g., ‘server’, ‘client’, ‘web.browser’, ‘web.cordova’) to specify what architecture the file is used with.

web.cordova for your mobile css
web.browser for your browser css


Thank you, that was easy …

<hanging head in shame>


For more complex scenarios where the dynamics are more than the choice between cordova/browser, you could use the isAsset flag, and load each file asynchronously depending on your rules.


Hey I was searchining info about this, and I saw your answer.
How can I load assets asynchronously from the package.js?


you cannot do that from package.js. I was refering to loading from within the client since the files you mark as isAsset end up outside the bundle but available to the application (like the public folder)