我是Ionic的新手。我已经开始使用超级模板进行项目。但是,当我尝试在浏览器中运行该应用程序时。它抛出一个错误,说:
ReferenceError: webpackJsonp is not defined
at http://localhost:8100/build/main.js:1:1
我试过将vendor.js放到index.html中,但是没有用。
这是index.html文件。我删除了vendor.js,因为它不起作用。
<!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>
遇到此错误时,我正在从事ReactJs项目。这可能是缺少
package.json
文件相关性的情况,最终这些相关性最终以OP报告的错误形式冒泡。在我们的案例中,缺少对omitJs npm软件包的引用。我在package.json
文件的“ 依赖项”部分中添加以下内容的那一刻,所有内容开始起作用: