I create a script named "FileUtil.jsx" to import a bunch of images and export them to another component.
import Oolong from '../assests/img/Oolong.png'
import ChaiTea from '../assests/img/ChaiTea.png'
import CharcoalRoastedOolong from '../assests/img/CharcoalRoastedOolong.png'
import HighMountainOolong from '../assests/img/HighMountainOolong.png'
import RubyBlackTea from '../assests/img/RubyBlackTea.png'
export const images={
"Oolong":Oolong,
"Chai Tea":ChaiTea,
"Charcoal Roasted Oolong":CharcoalRoastedOolong,
"High Mountain Oolong":HighMountainOolong,
"Ruby Black Tea":RubyBlackTea,
};
Another script named "OrderPage.jsx" which import images
import {images} from './FileUtil';
console.log(images['Oolong']);
console.log(images['Chai Tea']);
console.log(images['Charcoal Roasted Oolong']);
console.log(images['High Mountain Oolong']);
console.log(images['Ruby Black Tea']);
And I only got @fs occur in my first image path which is Oolong
@fs error:
After checking everything in my code, I still have no idea why this occurs. However, I could just remove @fs from my path after importing images, and everything works normally.
images['Oolong']=images['Oolong'].replace("/@fs",""); //in OrderPage.jsx
But, I still want to know why this happened. Could anyone explain this?