Ionique 2: ReferenceError: webpackJsonp n'est pas défini
je suis nouveau à Ionic. J'ai commencé le projet avec super template. Mais quand j'essaye d'exécuter l'application dans le navigateur. Il lance une erreur en disant:
ReferenceError: webpackJsonp is not defined
at http://localhost:8100/build/main.js:1:1
j'ai essayé de mettre le vendeur.js dans la page d'index.html mais qui n'a pas fonctionné.
Voici l'index.fichier html. J'ai enlevé le vendeur.js car ça n'a pas marché.
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Ionic App</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico">
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#4e8ef7">
<!-- cordova.js required for cordova apps -->
<script src="cordova.js"></script>
<!-- un-comment this code to enable service worker
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js')
.then(() => console.log('service worker installed'))
.catch(err => console.log('Error', err));
}
</script>-->
<link href="build/main.css" rel="stylesheet">
</head>
<body>
<!-- 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>
</body>
</html>
6 réponses
je viens littéralement de traverser la même chose que vous. J'ai ajouté le vendeur.script js avant le main.js / src / index.html - maintenant il fonctionne localement.
<!-- The polyfills js is generated during the build process -->
<script src="build/polyfills.js"></script>
<script src="build/vendor.js"></script>
<!-- The bundle js is generated during the build process -->
<script src="build/main.js"></script>
ceci est un changement de rupture dans Ionic-App-Scripts
https://github.com/ionic-team/ionic-app-scripts/releases/tag/v2.0.0
src / index.html doit être modifié pour inclure une nouvelle étiquette de script de fournisseur .
...
<body>
<!-- Ionic's root component and where the app will load -->
<ion-app></ion-app>
<script src="cordova.js"></script>
<!-- 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>
<!-- The bundle js is generated during the build process -->
<script src="build/main.js"></script>
</body>
...
Ajouter vendor.js
chemin à l'intérieur de la balise script dans < your application directory > /src/index.html
<script src="build/vendor.js"></script>
Également apporter des changements < your application directory >/src/service-worker.js
Fichier Include vendor.js
dans le precache
l'article:
// pre-cache our key assets
self.toolbox.precache(
[
'./build/main.js',
'./build/vendor.js', // <=== Add vendor.js
'./build/main.css',
'./build/polyfills.js',
'index.html',
'manifest.json'
]
);
je fais face au même problème quand j'ai commencé à développer le vieux projet ionic 2 avec ionic 3.
suivez ces étapes fonctionne pour moi.
opne src\index.html
mettre cette ligne
<script src="build/vendor.js"></script>
avant
<script src="build/main.js"></script>
et après
<script src="build/polyfills.js"></script>
comme ceci
<!DOCTYPE html>
...
<body>
<!-- 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>
<script src="build/vendor.js"></script> <---- here
<!-- The bundle js is generated during the build process -->
<script src="build/main.js"></script>
</body>
</html>
npm install -g ionic@v3.0.1
ou
yarn add -g ionic@v3.0.1
Ionique problème de version fr.
vérifier la version.
npm install -g ionic@v3.0.1
npm install -g ionic@v2.0.1
npm install -g ionic@v1