"web.mobile" architecture string for mobile browsers

Hi there,
my team and I wrote an app that runs in desktop browsers, mobile browsers and via cordova as native/hybrid apps.

Now we want to e.g. exclude urigo:ionic on all desktop browser but would like to leave it in for mobile browsers/cordova apps. For the mobile detection we’re using the simple mquandalle:ismobile package which is great, but now we also need to exclude whole packages, like e.g. urigo:ionic.

  • If we exclude the ionic package by architecture web.cordova, it is also excluded on mobile browsers
  • If we conditionally include ionic (via package + conditional head.html) ionic is loaded last and overrides all customization

What we need is the non existing “arch” called “web.mobile”. Does anyone have an idea how to solve this problem? Or is there a pattern we’re not aware of?

Cheers,
Max

Currently there is no mechanism to serve different code based on user agent, so the build system can’t differentiate between mobile browsers and desktop browsers.

I’m not sure if there are any hacks that will make what you’re trying to do possible; maybe someone else has an idea.

1 Like

I don’t have a precise solution, but webpack is the direction I’d suggest going. There’s some work being done to get webpack and meteor running alongside each other. If I understand the potential correctly, this would allow for conditional import of javascript code within meteor. So you could say if browser is x then import foo.