I am having an issue sharing a module between ng2 apps. Here is a very simple scenario to demonstrate the problem. Using angular-cli all the way:
- There's a SharedModule app, created with
ng new SharedModule
. - There's a MyApp app, created with
ng new MyApp
. - The module in SharedModule app exports a custom component (that I would like to use in MyApp app).
- The main module in MyApp imports the module from SharedModule app.
- When trying to run MyApp with
ng serve
, it blows with error:Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function...
Omitting the not important stuff, the very basic structure looks like this:
MyApp
|────angular-cli.json
|────package.json
|
└──src
└─app
|────app.module.ts
|────app-root.component.ts
└─
SharedModule
|────angular-cli.json
|────package.json
|
└─src
└─app
|────app-root.component.ts
|────custom-input.component.ts
|────shared.module.ts
└─
The key point here is that MyApp and SharedModule are two different apps. If I try to put the shared module inside MyApp (along with the exported custom component), then it works just fine. Unfortunately, this is not an option at the moment and I have to keep the modules/apps separate. Also creating an npm package from SharedModule and installing it into MyApp is not an option.
I've created a github repository demonstrating the problem. In order to run it:
- run
npm install
in MyApp and SharedModule folders. - run
npm start
in MyApp folder.
The million dollar question here is how can I make this work? Thanks.