gpt4 book ai didi

javascript - @包裹/核心: Failed to resolve 'index.html' Getting this error

转载 作者:行者123 更新时间:2023-12-03 08:14:32 29 4
gpt4 key购买 nike

我的 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"
}

我在互联网上找不到解决方案。在此之前,我收到此错误

@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 './'.

因此,我安装了 @parcel/resolver-glob 并在根目录中添加了 .parcelrc 以及此文本

{
"extends": "@parcel/config-default",
"resolvers": ["@parcel/resolver-glob"]
}

最佳答案

Parcel documentation来看不是很明显,但您需要通过将文字字符串 "..." 添加到解析器数组来包含默认解析器。

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", "..."]
^^^^^
}

关于javascript - @包裹/核心: Failed to resolve 'index.html' Getting this error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69823944/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com