Reputation: 29
My package.json file
{
"name": "aiky",
"version": "1.0.0",
"description": "Recipe application",
"default": "index.html",
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html --dist-dir ./dist"
},
"author": "Akash Kesharwani",
"license": "ISC",
"devDependencies": {
"@parcel/resolver-glob": "^2.0.0-rc.0",
"@parcel/transformer-image": "^2.0.0-rc.0",
"@parcel/transformer-sass": "^2.0.0-rc.0",
"parcel": "^2.0.0-rc.0",
"sass": "^1.26.10"
},
"dependencies": {
"core-js": "^3.6.5",
"fractional": "^1.0.0",
"regenerator-runtime": "^0.13.7"
},
"main": "index.js"
}
I can't find the solution over the internet. Before this, I was getting this error
@parcel/core: Failed to resolve 'src/img/test-1.jpg' from './index.html'
@parcel/resolver-default: Cannot load file './src/img/test-1.jpg' in './'.
So, I installed @parcel/resolver-glob and also added .parcelrc in root with this text
{
"extends": "@parcel/config-default",
"resolvers": ["@parcel/resolver-glob"]
}
Upvotes: 2
Views: 10854
Reputation: 9117
I was using yarn 4
and get this error. With npm
, it is OK.
PD: Parcel is commonly used for small project changes, so switching package manager to it may be a good solution, even though it won't solve the issue with yarn.
Upvotes: 0
Reputation: 11
I faced the same thing like this:
@parcel/core: Failed to resolve 'App.js' from './index.html' @parcel/resolver-default: Cannot load file './App.js' in './'.
The solution for this is make sure the index.html
and app.js
are not in the source folders.
Keeps the parcel installer updated.
Upvotes: 1
Reputation: 71
It's not very obvious from the Parcel documentation, but you will need to include the default resolvers by adding the literal string "..."
to the resolvers array.
The "..." syntax can be used to extend the default resolvers. This allows you to override the resolution for certain dependencies, but fall back to the default for others. Generally, you'll want to add your custom resolvers before running the default ones.
{
"extends": "@parcel/config-default",
"resolvers": ["@parcel/resolver-glob", "..."]
^^^^^
}
Upvotes: 6