The package.json was created with the yarn cli. It fails when I try to build it. If I remove "main": "src/index.js" it works. src/index.js exists but it's an empty file for now.
Do I need to specify the path to my bundle or why does this throw an error? Changing the path to what is suggested in the error message doesn't work either.
package.json
{
"name": "project",
"version": "0.1.0",
"description": "",
"main": "src/index.js",
"source": "src/index.html",
"browserslist": "supports es6-module",
"scripts": {
"start": "parcel --open chrome",
"build": "parcel build"
},
"repository": "",
"author": "",
"license": "MIT",
"dependencies": {
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0"
},
"devDependencies": {
"parcel": "^2.0.0-rc.0"
}
}
Output
$ parcel build
Build failed.
@parcel/namer-default: Target "main" declares an output file path of "src/index.js" which does not match the compiled bundle type "html".
.../project/package.json:5:11
4 | "description": "project",
> 5 | "main": "src/index.js",
> | ^^^^^^^^^^^^^^ Did you mean "src/index.html"?
6 | "source": "src/index.html",
7 | "scripts": {
Try changing the file extension of "main" in package.json.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.