Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

279
Vistas
Where should the path from main in package.json point to?

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.
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The main field in package.json is intended to be used by library developers (e.g. if you are building a package that you intend to publish to npm to be consumed by others). In this context, it specifies the output target - i.e. where parcel should put an optimized commonjs javascript bundle. (see high-level documentation and detailed documentation).

In your case, it seems like you're building an app, not a library, so I would recommend just removing the main field entirely, which should resolve the errors you are seeing.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda