模块解析失败:意外的令牌离子3

国标

升级到ionic和ionic-angular的最新模块后,出现此错误。这是升级后我的Package.json文件。

这是升级后我的Package.json文件。

在此处输入图片说明

运行时错误

Module parse failed: Unexpected token (84:1254) You may need an appropriate loader to handle this file type. | HomelistPage = __decorate([ | Component({ | selector: 'page-homelist',template:/*ion-inline-start:"/Users/macbook/Downloads/studio/src/pages/home/homelist/homelist.html"*/`<ion-header>\n <ion-navbar color="bluegray">\n <button ion-button menuToggle color="light">\n <ion-icon name="menu"></ion-icon>\n </button>\n <ion-title color="light">Instractors</ion-title>\n <ion-buttons right>\n <button color="light" ion-button icon-only (click)="createMessage()">\n <ion-icon name="more"></ion-icon>\n </button>\n </ion-buttons>\n </ion-navbar>\n <ion-toolbar color="bluegray">\n <ion-searchbar></ion-searchbar>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n <!--*********** 2 colomns list ***********-->\n <ion-grid>\n <ion-row wrap>\n <ion-col tappable col-6 *ngFor="let item of items" (click)="goToDetail(item.$key)" color="gray">\n <ion-card class="cardList">\n <div *ngIf="item.discount" class="ribbon pop-in">SALE</div>\n <img class="pop-in" src={{item.imgSmall}} />\n <ion-card-header>\n {{item.name}}\n </ion-card-header>\n <ion-card-content>\n <p *ngIf="!item.discount" ion-text color="special-blue">\n <strong>${{item.price}}</strong>\n </p>\n <p *ngIf="item.discount" ion-text color="special-blue" class="discount">${{item.price}}</p>\n <p *ngIf="item.discount" ion-text large color="red">\n <strong>${{item.discountPrice}}</strong>\n </p>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n </ion-grid>\n</ion-content>`/*ion-inline-end:"/Users/macbook/Downloads/studio/src/pages/home/homelist/homelist.html"*/, | }), | __metadata("design:paramtypes", [NavController, NavParams, ToastController,


Error: Module parse failed: Unexpected token (84:1254)
You may need an appropriate loader to handle this file type.
|     HomelistPage = __decorate([
|         Component({
|             selector: 'page-homelist',template:/*ion-inline-start:"/Users/macbook/Downloads/studio/src/pages/home/homelist/homelist.html"*/`<ion-header>\n  <ion-navbar color="bluegray">\n    <button ion-button menuToggle color="light">\n      <ion-icon name="menu"></ion-icon>\n    </button>\n    <ion-title color="light">Instractors</ion-title>\n        <ion-buttons right>\n          <button color="light" ion-button icon-only (click)="createMessage()">\n            <ion-icon name="more"></ion-icon>\n          </button>\n        </ion-buttons>\n  </ion-navbar>\n  <ion-toolbar color="bluegray">\n    <ion-searchbar></ion-searchbar>\n  </ion-toolbar>\n</ion-header>\n\n<ion-content>\n  <!--*********** 2 colomns list  ***********-->\n  <ion-grid>\n    <ion-row wrap>\n      <ion-col tappable col-6 *ngFor="let item of items" (click)="goToDetail(item.$key)" color="gray">\n        <ion-card class="cardList">\n          <div *ngIf="item.discount" class="ribbon pop-in">SALE</div>\n          <img class="pop-in" src={{item.imgSmall}} />\n          <ion-card-header>\n            {{item.name}}\n          </ion-card-header>\n          <ion-card-content>\n            <p *ngIf="!item.discount" ion-text color="special-blue">\n              <strong>${{item.price}}</strong>\n            </p>\n            <p *ngIf="item.discount" ion-text color="special-blue" class="discount">${{item.price}}</p>\n            <p *ngIf="item.discount" ion-text large color="red">\n              <strong>${{item.discountPrice}}</strong>\n            </p>\n          </ion-card-content>\n        </ion-card>\n      </ion-col>\n    </ion-row>\n  </ion-grid>\n</ion-content>`/*ion-inline-end:"/Users/macbook/Downloads/studio/src/pages/home/homelist/homelist.html"*/,
|         }),
|         __metadata("design:paramtypes", [NavController, NavParams, ToastController,
    at Object.448 (http://localhost:8100/build/main.js:1042:7)
    at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
    at Object.254 (http://localhost:8100/build/main.js:335:68)
    at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
    at Object.331 (http://localhost:8100/build/main.js:556:96)
    at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
    at Object.309 (http://localhost:8100/build/main.js:531:70)
    at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
    at webpackJsonpCallback (http://localhost:8100/build/vendor.js:26:23)
    at http://localhost:8100/build/main.js:1:1
国标

对于那些在升级到此版本后遇到此问题的人,@ionic/app-scripts : 3.1.0可以通过以下方法解决此问题,导航至node_modules/@ionic/app-scripts/dist/template.js:153该行并替换为

return getTemplatePrefix(htmlFilePath) + "'" + content + "'" + getTemplateSuffix(htmlFilePath);

这是该错误的手动修复,但已发布。@ionic/app-scripts : 3.1.1该错误已修复。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

模块解析失败:意外的令牌

webpack tsx 模块解析失败:意外的令牌

Vue 模块解析失败:意外的令牌

模块解析失败:意外的令牌(11:19)

如何解决模块解析失败:意外的令牌?

模块解析失败:使用webpack-dev-server的意外令牌

模块解析失败:React Component Render上的意外令牌

Webpack 4基本React js hello world因“模块解析失败:意外令牌”而失败

模块解析失败:意外字符'@'

Webpack 无法解析打字稿文件。模块解析失败:意外的令牌

模块构建失败:SyntaxError:意外令牌

模块解析失败:使用 webpack 5 时出现意外令牌

ons-navigator:错误:模块解析失败:意外令牌(330:6)

模块解析失败:构建与Webpack交互时出现意外的令牌(6:16)

React JS:index.css 1:0中的错误(模块解析失败:意外令牌(1:0))

模块解析失败:意外令牌(1:0)vue.js vuex存储

模块解析失败:Webpack Typescript加载器中出现意外令牌

React和Webpack模块解析失败:/testimonials.js意外令牌(6:4)

模块解析失败:heroku 部署时出现意外令牌 (14:6)

模块解析失败:使用babel-loader发生意外的令牌(9:37)

模块解析失败:意外的令牌。react-native / index.js“ typeof”运算符

vue js 服务问题 - 模块解析失败:意外令牌 (763:13)

fsevents导致模块解析失败:意外字符'

模块解析失败:意外字符'@'(1:0)

Nuxt - 模块解析失败:意外字符“#”

webpack模块解析失败意外字符“ @”

模块解析失败:* .ts意外字符“ @”

反应-模块解析失败:意外的令牌。您可能需要适当的加载程序来处理此文件类型

React / Webpack-“模块解析失败:意外的令牌-您可能需要适当的加载器来处理此文件类型。”