我想从文件夹中导入所有图像并希望根据需要使用。但不能通过以下方法做到这一点。我在做什么?这:
import * as imageSrc from '../img';
let imageUrl = [];
imageSrc.map(
imageUrl.push(img)
))
我在 console.log 中收到此错误
index.js:1452 ./src/components/Main.jsx
Module not found: Can't resolve '../img' in 'G:\Projects\Personal\Portfolios\Portfolio_Main\React_portfolio\portfolio\src\components'
文件夹结构:
src>
components>
Main.jsx
img>
[all image files]