【发布时间】:2017-12-12 18:40:54
【问题描述】:
我是 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>
【问题讨论】:
-
这主要是因为项目使用了代码拆分,webpack的代码是在
main.jschunk之后加载的 -
您能提供更多信息吗?此错误表示代码尚未加载 webpack 运行时,但根据给定信息无法判断原因。
-
你删除了 vendor.js 是什么意思?很确定 webpack 的运行时在某处
-
@thangngoc89 把它放在那里没有用。以前没有。
标签: javascript ionic-framework webpack