I have 1000 images in folder and I have to import all those images to project. I tried this:
import images from './img/*.jpg
It works just fine on localhost but when I try to deploy it on remote server it throws an error:
Build failed.
8:44:50 AM: @parcel/core: Failed to resolve './../img/*.jpg' from './src/js/model.js'
8:44:50 AM: /opt/build/repo/src/js/model.js:1:18
8:44:50 AM: > 1 | import imgs from './../img/*.jpg';
8:44:50 AM: > | ^^^^^^^^^^^^^^^^^^^^
8:44:50 AM: 2 | import { AMOUNT_OF_IMAGES } from './config.js';
8:44:50 AM: 3 |
8:44:50 AM: @parcel/resolver-default: Cannot load file '../img/*.jpg' in './src/js'.
8:44:50 AM: Did you mean '../img/1.jpg'?
8:44:50 AM: Did you mean '../img/2.jpg'?
My package.json:
{
"default": "index.html",
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html -d ./dist --no-minify"
},
"license": "ISC",
"devDependencies": {
"@parcel/transformer-image": "^2.0.0-rc.0",
"parcel": "^2.0.0-rc.0",
"parcel-bundler": "1.12.5"
},
"dependencies": {
"core-js": "^3.18.0",
"img": "^3.0.3",
"regenerator-runtime": "^0.13.9"
}
}