Issue with importing an external module in rc0

Hello everyone

I am facing an issue with ionic2 rc0, and this is a quite complex one :expressionless:

I have a package (entity-manager-mobile) that I have written in typescript that is compiled to CommonJS modules. I am installing it via npm and importing in my iconic 2 project like this (app.module.ts):

import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
//...
import { EntityManagerModule } from 'entity-manager-mobile';

@NgModule({
  declarations: [
    MyApp,
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    EntityManagerModule,
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
  ],
  providers: []
})
export class AppModule {}

And it worked fine on beta-32 when I was using the SystemJS configuration and putting a reference to this module in the map section. But now on rc0 rollup is used to bundle modules, and it fails at compilation stage with “can not find module” for all external dependencies of my module.

Like this

[13:30:31] node_modules/entity-manager-mobile/src/applicationVersion.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.
[13:30:31] node_modules/entity-manager-mobile/src/encryptionKey.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.
[13:30:31] node_modules/entity-manager-mobile/src/encryptionKey.service.ts(3,21): error TS2307: Cannot find module ‘crypto-js’.
[13:30:31] node_modules/entity-manager-mobile/src/factory/entityFactory.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.
[13:30:31] node_modules/entity-manager-mobile/src/factory/entityIdentifier.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.
node_modules/entity-manager-mobile/src/hal/hal.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.
node_modules/entity-manager-mobile/src/headers/header.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.
[13:30:31] node_modules/entity-manager-mobile/src/headers/jwt.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.
[13:30:31] node_modules/entity-manager-mobile/src/manager/entity.service.ts(3,20): error TS2307: Cannot find module ‘lodash’.
[13:30:31] node_modules/entity-manager-mobile/src/storage/sessionStorage.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.
[13:30:31] node_modules/entity-manager-mobile/src/storage/storage.service.ts(2,30): error TS2307: Cannot find module ‘localforage’.
[13:30:31] node_modules/entity-manager-mobile/src/storage/storage.service.ts(3,20): error TS2307: Cannot find module ‘lodash’.
[13:30:31] node_modules/entity-manager-mobile/src/store/entityStore.service.ts(3,20): error TS2307: Cannot find module ‘lodash’.
node_modules/entity-manager-mobile/src/store/localEntityStore.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.
[13:30:31] node_modules/entity-manager-mobile/src/store/remoteEntityStore.service.ts(2,20): error TS2307: Cannot find module ‘lodash’.

I know an intermediate tsconfig.tmp.json is created by the ionic-scripts with a custom include section, so I tried installing typings for those external modules and referencing them in order to avoid typescript compilation issues.
Then the typescript compilation does not give any errors, but the rollup.js bundle creation fails, so my app does not start.

[13:44:56] bundle dev started …
[13:44:56] Error: Could not resolve entry (./.tmp/app/main.dev.js)
at C:\dev\mypxs-ionic2-poc\node_modules\rollup\dist\rollup.js:8602:28
at process._tickCallback (internal/process/next_tick.js:103:7)

Can you give me any ideas on how to tackle the problem?

PS.I am not a rollup.js expert but I think the problem is related to it.

Any help will be much appreciated :slight_smile: