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

feat: Make mime-types package optional #383

Closed
wants to merge 1 commit into from
Closed

Conversation

ptbrowne
Copy link
Contributor

@ptbrowne ptbrowne commented Mar 8, 2019

mime-db (on which mime-types rely) is very big (see cozy/cozy-banks#926) and not all apps rely on automatic
file type from extension.

Related : #373

In this PR, mime-types is made optional, if an app wants to
use automatic file type detection from extension, it can
add manually the mime-types package (Drive :) ).

"qs": "6.6.0"
},
"optionalDependencies": {
"mime-types": "2.1.20"
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand, if we put mime-types in optionalDependencies, yarn&npm will try by default to install it. I don't know if we shouldn't put in peerDependencies.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

peerDependency allows us to define the version of the dependency outside of the lib. It's aimed a not duplicating modules across different libraries. peerDependencies are required dependencies, they will always be present in the final lib

@ptbrowne
Copy link
Contributor Author

ptbrowne commented Mar 8, 2019

Closing in favor of #373

An app can use a webpack alias to an empty file if it does not need mime functionality.

@ptbrowne ptbrowne closed this Mar 9, 2019
@ptbrowne ptbrowne deleted the no-mime-type branch March 9, 2019 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants