[英]@parcel/core: Failed to resolve 'index.html' Getting this error
My package.json file我的 package.json 文件
{
"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所以,我安装了 @parcel/resolver-glob 并在 root 中添加了.parcelrc与此文本
{
"extends": "@parcel/config-default",
"resolvers": ["@parcel/resolver-glob"]
}
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.从Parcel 文档中它不是很明显,但是您需要通过将文字字符串
"..."
到解析器数组来包含默认解析器。
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", "..."]
^^^^^
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.