我已经有一个用angular4编写的项目,现在,我希望将ionic2组件引入其中,以便它可以在移动设备中使用。我喜欢ionic2,因为它有很多移动友好功能。 我不想重新开始新项目,因为我们当前的ng4应用程序非常复杂,我需要尽可能多地重用组件/代码。理想情况下,如果我只需要引入一些ionic2模块,那就太棒了。
我在package.json
中引入了一些ionic2包"@ionic-native/core": "3.4.2",
"@ionic-native/splash-screen": "3.4.2",
"@ionic-native/status-bar": "3.4.2",
"@ionic/storage": "2.0.1",
"ionic-angular": "3.0.1",
"ionicons": "3.0.0",
"@ionic/app-scripts": "1.3.0"
在app.module.ts中。改为:
import {NgModule, ErrorHandler} from '@angular/core'
import { BrowserModule } from '@angular/platform-browser';
import {AppComponent} from './app.component'
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
@NgModule( {
imports: [BrowserModule, IonicModule.forRoot( AppComponent )],
declarations: [AppComponent],
bootstrap: [IonicApp],
entryComponents: [
AppComponent
],
providers: [
StatusBar,
SplashScreen,
{ provide: ErrorHandler, useClass: IonicErrorHandler }
]
})
当我开始时,我确实看到了很多警告,例如:
WARNING in ./~/ionic-angular/umd/index.js
Critical dependencies:
6:24-31 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/ionic-angular/umd/index.js 6:24-31
WARNING in ./~/ionic-angular/umd/config/config.js
Critical dependencies:
3:24-31 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/ionic-angular/umd/config/config.js 3:24-31
也在浏览器中,我确实看到了:
./~/ionic-angular/umd/platform/platform-registry.js
Critical dependencies:
3:24-31 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/ionic-angular/umd/platform/platform-registry.js 3:24-31
warnings @ client?cd17:68
client?cd17:68 ./~/ionic-angular/umd/config/mode-registry.js
Critical dependencies:
3:24-31 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/ionic-angular/umd/config/mode-registry.js 3:24-31
是否有人成功将ionic2添加到ng2项目?你是怎么做到的?
由于