question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v2] bad error message for package.json#main mismatch with html entry point: "Destination name index.js extension does not match bundle type "html"

See original GitHub issue

🐛 bug report

parcel build is broken. if you take the basic index.html/styles.css setup in the readme: https://github.com/parcel-bundler/parcel/tree/v2#getting-started

you can run parcel index.html fine, but when you run parcel build you get the above mentioned error

🎛 Configuration (.babelrc, package.json, cli command)

{
  "name": "netlify-drop-demo-site-master",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "https://github.com/sw-yx/netlify-drop-demo-site-master.git",
  "author": "sw-yx <swyx@dontemail.me>",
  "license": "MIT",
  "devDependencies": {
    "parcel": "^2.0.0-alpha.1.1"
  },
  "scripts": {
    "build": "parcel build basic.html"
  },
  "dependencies": {
    "react": "^16.9.0",
    "react-dom": "^16.9.0"
  }
}

🤔 Expected Behavior

it should build

😯 Current Behavior

doesnt build

yarn run v1.17.0
$ /Users/swyx/Downloads/netlify-drop-demo-site-master/node_modules/.bin/parcel build basic.html
🚨 Destination name index.js extension does not match bundle type "html"
    at BundlerRunner.nameBundle (/Users/swyx/Downloads/netlify-drop-demo-site-master/node_modules/
@parcel/core/lib/BundlerRunner.js:137:17)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

💁 Possible Solution

no idea

🔦 Context

just trying to try out parcel v2

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-alpha.1.1
Node 10.13
npm/Yarn 6.51/1.17
Operating System osx latest

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

14reactions
kwelchcommented, Sep 6, 2019

I think could be related to your package.json#main. It uses that to define the output files and your entry is an html file, but your main is expected it to output as a js file. Try updating your main to dist/index.html

13reactions
mischniccommented, Sep 22, 2021

https://v2.parceljs.org/features/targets/#library-targets:

To make Parcel ignore one of these fields, specify false in the targets field.

{
 "main": "unrelated.js",
 "targets": {
   "main": false
 }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Where should the path from main in package.json point to?
@parcel/namer-default: Target "main" declares an output file path of "src/index.js" which does not match the compiled bundle type "html". .../ ...
Read more >
package.json - npm Docs
Description. This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just...
Read more >
Main entry point does not exist - Cyclic Documentation
If you get an error in the deploy log that says that your package.json points to a file that does not exist, here...
Read more >
@parcel/fs NPM | npm.io
html file, they won't be merged together. Bundle Name, Assets, Entry URL. index.html, index.html, /.
Read more >
NetSuite Applications Suite - The distro.json and ns.package ...
Choosing an Intrastat Declaration Type · Region of Origin and Destination ... Create Your CCT as an Extension · Create the Entry Point...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found