Search code examples
javascriptnpmpackage.jsonparceljs

Trying to build project with parcel, but keep running into unsupported file type error


I am trying to build a project with parcel. I have followed all the instructions from my assignment, yet this error keeps showing up on my terminal whenever I try to run:

parcel src/index.html

This is the error message:

Build failed.

@parcel/core: Unexpected output file type .html in target "main"

C:\Users\johan\myflix-client\package.json:4:11 3 | "version": "1.0.0",

4 | "main": "src/index.html", | ^^^^^^^^^^^^^^^^ File extension must be .js, .mjs, or .cjs 5 | "scripts": { 6 | "test": "echo "Error: no test specified" && exit 1"

ℹ The "main" field is meant for libraries. If you meant to output a .html file, either remove the "main" field or choose a different target name.

I have even tried to remove the "main" altogether even though I was told that I needed it there, and it just throws more errors.

Please any help on this is greatly appreciated!


Solution

  • In package.json, you can try changing "main" to "default":

    "default": "index.html"