Modules sharing between ionic and angular 5 web app

Hi,

I am trying to share the logic part between an ionic 3 and angular 5 web app. Finally I come up with structure as below, and the app work properly.

Here is my project structure:

project_folder

ionic_app
- node_modules

angular_web
- node_modules

core_modules
- node_modules

The problem comes when I build the ionic app with --prod flag, it fails at the AOT compiling. Errors show as below:

[11:05:58] ngc started …
[11:06:07] typescript 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, resolving
        symbol Injectable in
        /Users/alvin.ho/Documents/my-project/node_modules/core_modules/node_modules/@angular/core/core.d.ts,
        resolving symbol BrowserXhr in
        /Users/alvin.ho/Documents/my-project/node_modules/core_modules/node_modules/@angular/http/http.d.ts,
        resolving symbol BrowserXhr in
        /Users/alvin.ho/Documents/my-project/node_modules/core_modules/node_modules/@angular/http/http.d.ts

[11:06:07] ionic-app-script task: “build”
[11:06:07] Error: The Angular AoT build failed. See the issues above
Error: The Angular AoT build failed. See the issues above
at /Users/alvin.ho/Documents/my-project/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:237:55
at step (/Users/alvin.ho/Documents/my-project/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:32:23)
at Object.next (/Users/alvin.ho/Documents/my-project/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:13:53)
at fulfilled (/Users/alvin.ho/Documents/my-project/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:4:58)

Does anyone can address the issue?