Skip to content
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

Throw an error for "main": "something.html" in package.json #6110

Closed
mischnic opened this issue Apr 10, 2021 · 3 comments · Fixed by #6517
Closed

Throw an error for "main": "something.html" in package.json #6110

mischnic opened this issue Apr 10, 2021 · 3 comments · Fixed by #6517

Comments

@mischnic
Copy link
Member

🐛 bug report

It happens way too often that "main": "index.html" is specified in package.json, and the source files are overwritten.

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

{
    "name": "foo",
    "version": "1.0.0",
    "main": "index.html",
    "license": "MIT",
    "private": true
}

🤔 Expected Behavior

"main" musn't specified a HTML file. Remove this property

😯 Current Behavior

Builds something

💁 Possible Solution

Should be checked in here: https://github.com/parcel-bundler/parcel/blob/v2/packages/core/core/src/requests/TargetRequest.js

@devongovett
Copy link
Member

Also if main points to a JS file but the entry is HTML (e.g. auto-generated package.json). Either just ignore that or error too?

@mischnic
Copy link
Member Author

I would say error in that case as well. The possibilites to fix that would be to either remove the property or if you actually need it, add targets: {main: false}

@mischnic
Copy link
Member Author

It should just always error if the type isn't JS. (e.g. "main": "index.ts")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants