-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v2] bad error message for package.json#main mismatch with html entry point: "Destination name index.js extension does not match bundle type "html" #3500
Comments
I think could be related to your |
We should add a better error message for this... |
i see, thanks kyle. yeah.. if im specifying my entry point in the cli, i dont expect my package json main to have Any Effect at all... so this feels like a nasty implicit relationship here that isnt documented. |
Parcel uses the |
Based on this feedback and other confusion about this, we're considering only using |
right. whatever you decide, i'll be happy as long as it gets logged somewhere, aka |
ran into this again today :( if i get time i would love to contribute a PR. can you give me some guidelines as to what you would like parcel to do in this scenario? should we warn early (might preempt more issues) or only at the site of the error (more local but super specific)? |
oh wow, just figured out that if you just leave out the "main" field in package.json and run |
@sw-yx what do you think of the below error message? Trying to make it as clear as possible. |
i think it is a huge improvement, but also do we want to let people specify i think fwiw the reason i often have errant |
|
ok gotcha. well, i look forward to when this pr lands! |
Landed in #3863! |
Parcel2 uses main as entry point target. But, main requires js when parcel's entry is html. Removing it apparently does the trick. Build worked locally. See: parcel-bundler/parcel#3500
Sorry to up this @sw-yx , but I'm in this exact situation. I'm making a JS library, so i have a "main" field targeting an "index.js" file. I also have a small demonstration web page for the library, which I build with This worked fine with Parcel v1, but now that I want to upgrade to Parcel 2, I'm stuck with this error message, and I cannot remove the "main" field. What am I supposed to do here ? |
https://v2.parceljs.org/features/targets/#library-targets:
|
if you are not trying to write a library you can completely delete |
Could be nice to give a hint in the error messages, stating something like if you are building a web app leave the main field undefined or include that high up in the documentation for setting up a project. Running npm init generates the main field. The out of the box experience of running parcel build is then a failure due to "@swc/helpers" which when resolves states that main should be index.html, I did not see the message remove the main field in the error message. I tend to read lists of solutions more then a multiple options in a single sentence. Anyway I figured it out just leaving my 2 cents here. Thanks. |
Encountered the same issues with main field. |
🐛 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-startedyou can run
parcel index.html
fine, but when you runparcel build
you get the above mentioned error🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
it should build
😯 Current Behavior
doesnt build
💁 Possible Solution
no idea
🔦 Context
just trying to try out parcel v2
🌍 Your Environment
The text was updated successfully, but these errors were encountered: