webpackJsonp not found when running ionic-starter-aws


#1

The starter for integration an Ionic app with AWS Mobile Hub sounds very promising! Unfortunately I cannot get it up and running:

Runtime Error: webpackJsonP is not defined
Stack: @http://localhost:8100/build/main.js:1:1

…when running ionic serve. I am trying to resolve this issue for days. No success. Any ideas? Thanks in advance!

My environment:
Ionic Framework: 3.5.0
Ionic App Scripts: 2.0.0
Angular Core: 4.1.3
Angular Compiler CLI: 4.1.3
Node: 6.11.0
OS: Windows 10


#2

Did you update index.html to refer to vendor.js?

Edit: actually, just post your index.html. If you put the ref in the wrong place, it can cause the problem too.


#3

Hi Aaron, thanks for the quick reply:-) I already read about this. If I understood it correctly I should take care the the 3rd party/vendor *.js files are loaded before the main.js. This is true.

Here is the index.html:


#4

Is there a newer version? Your file should look something like

<!-- Ionic's root component and where the app will load -->
  <ion-app></ion-app>

  <!-- The polyfills js is generated during the build process -->
  <script src="build/polyfills.js"></script>

  <!-- all code from node_modules directory is here -->
  <script src="build/vendor.js"></script> // <-- I didn't see this in your link

  <!-- The bundle js is generated during the build process -->
  <script src="build/main.js"></script>

#5

No, this is exactly what I get when running ionic start project-name and then selecting the aws starter

  <!-- Ionic's root component and where the app will load -->
  <ion-app></ion-app>

  <!-- The polyfills js is generated during the build process -->
  <script src="build/polyfills.js"></script>

  <!-- The bundle js is generated during the build process -->
  <script src="build/main.js"></script>

There is also no build/vendor.js generated.


#6

Then it’s not compatible with app-scripts 2. Add the missing lines, and webpack will probably build your project. Or you can revert to an earlier version of app-scripts.


#7

Okay. I will try this. Thanks for your help!!!


#8

I added
<script src="build/vendor.js"></script>
to my index.html

Worked like a charm:-)
Now, build/vendor.js is also created.

Thank you so much!


#9

I created a pull request to fix this: https://github.com/ionic-team/ionic2-starter-aws/pull/29 Seems to have been forgotten when updating the ionic2-app-base to use app-scripts 2.x


#10

This is great! Thanks!


#11

thanks you .this solution is woks me


#12

Hi all, just one more thing, you need to place it before the main.js call.


#13

I’ve found the same problem with the starter kit: Login-Register PHP OAuth 2 API (login-register-&-php-oauth-2-api).
The fix works also for it.


#14

thanks i was so confused


#15

Hey after i add the

 <!-- all code from node_modules directory is here -->
  <script src="build/vendor.js"></script>

every time i run ionic serve its being wiped out, any ideas?


#16

Just be sure you add the vendor.js to the src index.html not the www or it will be deleted upon build


#17

My index.html had what was mentioned here and I am still getting the same error. Is there anything else that needs to be done?


#19

this helps me


#20

Ionic version problem bro.

check the version.

npm install -g ionic@v3.0.1
npm install -g ionic@v2.0.1
npm install -g ionic@v1