ionic2horizon

Ionic2/Horizon error when importing


I have a (maybe simple) problem. I just want to import @horizon/client in my Ionic 2 app... When I type:

import {Horizon} from '@horizon/client';

then I get an error: "Cannot find module @horizon/client" and second: "Cannot find module 'imports?this=>global!exports?global.fetch!isomorphic-fetch'. (I also tried with many combinations e.g pointing to dist directory but still no luck.


Solution

  • This issue is related to a "hacky" webpack configuration which prevents this to work for you.

    You can try to use horizon 2 beta in which this workaround is no longer necessary.

    If you use webpack, you can install exports-loader and imports-loader, this would also get rid of the problem in the current horizon version.

    You also might want to follow these issues for more information/help: https://github.com/rethinkdb/horizon/issues/477 https://github.com/rethinkdb/horizon/issues/571