WebpackJsonp missing after Ionic 3 update

2019-03-05 06:44发布

问题:

I recently bumped up to ionic 3 from 2. I can build my app for iOS, but ionic serve fails now with the error below.

Before I could build for iOS, I had to manually replace main.prod.ts and main.dev.ts with main.ts

Would you need any more info to be able to help?

Close
Runtime Error
webpackJsonp is not defined
Stack


ReferenceError: webpackJsonp is not defined
    at http://localhost:8100/build/main.js:1:1
Ionic Framework: 2.0.0-rc.3
Ionic Native: 2.2.3
Ionic App Scripts: 2.0.2
Angular Core: 2.1.1
Angular Compiler CLI: 2.1.1
Node: 6.9.2
OS Platform: macOS Sierra
Navigator Platform: MacIntel
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36


TypeError: ctx.sourceFile.getLineEndOfPosition is not a function
    at isEntireLine (/Users/me/Documents/Typescript/app/node_modules/tslint/lib/rules/noUnusedVariableRule.js:217:32)
    at removeAll (/Users/me/Documents/Typescript/app/node_modules/tslint/lib/rules/noUnusedVariableRule.js:209:17)
    at /Users/me/Documents/Typescript/app/node_modules/tslint/lib/rules/noUnusedVariableRule.js:164:13
    at /Users/me/Documents/Typescript/app/node_modules/tslint/lib/rules/noUnusedVariableRule.js:285:23
    at visitEachNode (/Users/me/Documents/Typescript/app/node_modules/typescript/lib/typescript.js:8338:30)
    at Object.forEachChild (/Users/me/Documents/Typescript/app/node_modules/typescript/lib/typescript.js:8498:24)
    at forEachImport (/Users/me/Documents/Typescript/app/node_modules/tslint/lib/rules/noUnusedVariableRule.js:283:15)
    at addImportSpecifierFailures (/Users/me/Documents/Typescript/app/node_modules/tslint/lib/rules/noUnusedVariableRule.js:139:5)
    at walk (/Users/me/Documents/Typescript/app/node_modules/tslint/lib/rules/noUnusedVariableRule.js:130:9)
    at /Users/me/Documents/Typescript/app/node_modules/tslint/lib/rules/noUnusedVariableRule.js:38:75

回答1:

https://forum.ionicframework.com/t/webpackjsonp-missing-after-ionic-3-update/99582/6 In src/index.html add

<script src="build/vendor.js"></script> 


回答2:

I did this :

rm -rf node_modules
added <script src="build/vendor.js"></script> in index.html
npm install -g ionic@latest
npm install @ionic/app-scripts@latest --save-dev
npm install ionic-angular@latest --save
npm upgrade for upgrade all modules.
This worked and now everything runs well