Server running error in parcel by starting the external file index.html I Ignoring the main but it also doesn't work(Build Failed)

Viewed 17

[Build Error in parcel @ 2.7.0 start when I am trying to add external index.html file in the main I also ignored the main but it also doesn't work for me. Will please someone help me to solve this problem It also not working with JavaScript file when I added externally and also getting error with html file but I want to add the html file but as a solution I try to add JavaScript file but it also doesn't work for me. Will please someone solve this issue or tell me how to solve this issue

{
  "name": "forkify",
  "version": "1.0.0",
  "description": "",
  "main": "unrelated.js",
  "targets": {
    "main": false
  },
  "scripts": {
    "start": "parcel start index.html",
    "build": "parcel build index.html"
  },
  "author": "Meelad Sultan",
  "license": "ISC",
  "devDependencies": {
    "parcel": "^2.7.0"
  }
}

enter code here
1 Answers

At last I can find the solution of my problem after almost a day if someone else facing the same problem they just do add the **Browsers list ** in the package.json file before script and ignore the main target and also set the parcel to latest then the parcel will run successfully and do not give any server error or build error. And don't forget to run periodically npx browerlist@latest --update-db. It will update your package-lock file with new caniuse-lite version. In this case, you will be sure that last two version or > 0.2% will target what you expect { "name": "forkify", "version": "1.0.0", "description": "", "main": "unrelated.js", "target": { "main": false }, "browserslist": "> 0.5%, last 2 versions, not dead", "scripts": { "start": "parcel index.html " }, "author": "Meelad Sultan", "license": "ISC", "devDependencies": { "@parcel/transformer-sass": "^2.7.0", "parcel": "latest" }, "dependencies": { "sass": "^1.55.0" } }

Related