我正在使用 laravel 和 vue.js 创建网站。
当我运行'npm run dev'时,控制台中没有显示错误。
但是,如果我运行“npm run prod”,下面会出现错误。
Cannot read property 'call' of undefined at i (app.js 1)
function i(e) {
if (n[e])
return n[e].exports;
var r = n[e] = {
i: e,
l: !1,
exports: {}
};
//console says that this line's 'i' is the cause of the error.
return t[e].call(r.exports, r, r.exports, i),
r.l = !0,
r.exports
}
i.e = function(t) {
我不知道这个“i”是什么以及它来自哪里。
有没有办法通过这个js文件找出原因或解决办法?
如果您需要更多信息来解决此问题,请告诉我。
感谢您的合作。
更新
我找到了发生此错误的原因。
发生错误的页面是照片列表页面。 如果我尝试使用每个组件渲染每张照片,就会发生错误。
例如...
<template>
<div class="photo-list" ontouchstart="">
<h2 v-show="noPhoto">There are no photos in this page.</h2>
<div class="images" v-for="photo in photos" :key="photo.url">
<PhotoComponent v-bind:item=photo></PhotoComponent>
</div>
<PaginateComponent :current-page="currentPage" :last-page="lastPage"></PaginateComponent>
</div>
</template>
另一方面,如果我尝试在不使用组件的情况下渲染照片,错误就会消失。
例如...
<template>
<div class="photo-list" ontouchstart="">
<h2 v-show="noPhoto">There are no photos in this page.</h2>
<div class="images" v-viewer="{movable: false}">
<a class="luminous" v-for="photo in photos">
<img class="item" :src="photo.url" :key="photo.url"
alt="This photo taken by~~~.">
</a>
</div>
<PaginateComponent :current-page="currentPage" :last-page="lastPage"></PaginateComponent>
</div>
</template>
但是,我不知道为什么这种差异会触发错误。