gpt4 book ai didi

javascript - 如何解决 Ionic Uncaught Error : Cannot find module "." when adding new page?

转载 作者:太空狗 更新时间:2023-10-29 18:28:56 25 4
gpt4 key购买 nike

Uncaught Error: Cannot find module "."

    at webpackMissingModule (index.js:3)
at e.code (index.js:3)
at Object.<anonymous> (index.js:9)
at __webpack_require__ (bootstrap ee3a374a94c4cd74e2a6:54)
at Object.256 (main.ts:5)
at __webpack_require__ (bootstrap ee3a374a94c4cd74e2a6:54)
at Object.233 (main.js:412)
at __webpack_require__ (bootstrap ee3a374a94c4cd74e2a6:54)
at webpackJsonpCallback (bootstrap ee3a374a94c4cd74e2a6:25)
at main.js:1

在应用程序中添加新的 bookmarks 页面之前,应用程序运行良好,添加 bookmarks 页面后,我收到 Uncaught Error: Cannot find module"。 "

这是我的设置

Ionic Framework: 3.9.2
Angular Core: 5.2.11
Angular Compiler CLI: 5.2.11
Node: 8.11.1

app.module.ts

import { ContactPage } from '../pages/contact/contact';
import { BookmarksPage} from'../pages/bookmarks/bookmarks';

@NgModule({
declarations: [
ContactPage,
BookmarksPage,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
ContactPage,
BookmarksPage,
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}

bookmarks.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

@Component({
selector: 'page-bookmarks',
templateUrl: 'bookmarks.html'
})
export class BookmarksPage {
constructor(public navCtrl: NavController) {
}
}

index.js in developer console

我也尝试过清除缓存和 npm rebuild。在构建 (ionic serve) 过程中没有错误。但是在浏览器中我得到找不到模块,我真的很想了解这里发生了什么

最佳答案

从导入中删除 umd

改变

 import { NavController } from 'ionic-angular/umd';

 import { NavController } from 'ionic-angular';

检查 this了解更多详情。

关于javascript - 如何解决 Ionic Uncaught Error : Cannot find module "." when adding new page?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51726528/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com