webpackJsonp not found when running ionic-starter-aws

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 Likes

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.

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:

1 Like

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>
8 Likes

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.

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.

1 Like

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

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!

2 Likes

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

1 Like

This is great! Thanks!

thanks you .this solution is woks me

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

1 Like

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.

thanks i was so confused

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?

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

1 Like

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?

this helps me

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