当我尝试将Vue应用程序部署到Heroku时,出现以下我以前没有收到的构建错误:
ERROR in ./~/vue-loader/lib/template-compiler?{"id":"data-v-10bd33eb","hasScoped":false,"transformToRequire":{"video":"src","source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./~/vue-loader/lib/selector.js?type=template&index=0!./src/components/About.vue
Module not found: Error: Can't resolve '../assets/Noam.jpg' in '/tmp/build_4e0206e4d9f7ce1235a91f8c7dbd5035/src/components'
@ ./~/vue-loader/lib/template-compiler?{"id":"data-v-10bd33eb","hasScoped":false,"transformToRequire":{"video":"src","source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./~/vue-loader/lib/selector.js?type=template&index=0!./src/components/About.vue 2:1080-1109
@ ./src/components/About.vue
@ ./src/router/index.js
@ ./src/main.js
Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharefare@1.0.0 build: `node build/build.js`
该错误只是抱怨单个图像(Noam.jpg
)的尺寸和属性与其他图像相同。该文件位于assets
文件夹中的components
文件夹中。当我启动服务器并进入站点时,图像会加载,但失败仅发生在Heroku构建上。
About.vue
<template>
<div id="about">
<br>
<div id="header">
<h1>Who we are</h1>
</div>
<ul>
<li><figure><img src="../assets/Paul.jpg"><figcaption>Paul Attara</figcaption></figure></li>
<li><figure><img src="../assets/Lucas.jpg"><figcaption>Lucas Bellido</figcaption></figure></li>
<li><figure><img src="../assets/Arielle.jpg"><figcaption>Arielle Lasry</figcaption></figure></li>
</ul>
<ul>
<li><figure><img src="../assets/Kamy.jpg"><figcaption>Kamy Moussavi</figcaption></figure></li>
<li><figure><img src="../assets/Eden.jpg"><figcaption>Eden Ovadia</figcaption></figure></li>
<li><figure><img src="../assets/Noam.jpg"><figcaption>Noam Suissa</figcaption></figure></li>
</ul>
<ul>
<router-link to="/" id="back">Back to Home</router-link>
</ul>
</div>
</template>