一直提示 Uncaught Error: Cannot find module './6jpg'.
使用require将图片的json引入进来,控制台一直报错
Uncaught Error: Cannot find module './6jpg'.
代码如下
//获取图片相关数据 let imageDatas = require('../data/imageDatas.json'); let yeomanImage = require('../images/yeoman.png'); var genImageUrl = imageDataArr => { for (var i =0,j=imageDataArr.length;i<j;i++) { let singleImageData = imageDataArr[i]; singleImageData.imageUrl = require('../images/' + singleImageData.fileName); imageDataArr[i] = singleImageData; } return imageDataArr; }; imageDatas = genImageUrl(imageDatas); console.log(imageDatas);
singleImageData.imageUrl = require('../images/' + singleImageData.fileName);
这行代码引入图片途径是报错
请问应该怎么调整,目前并没有找到错误出在哪里?