fix: mime.getType is not a function in CJS build (#416)#417
Merged
MrRefactoring merged 1 commit intomasterfrom Feb 26, 2026
Merged
fix: mime.getType is not a function in CJS build (#416)#417MrRefactoring merged 1 commit intomasterfrom
MrRefactoring merged 1 commit intomasterfrom
Conversation
Use mime-types instead of mime for ESM/CJS compatibility. v5.3.1.
c50561c to
8869b7f
Compare
Owner
Author
|
Hi everyone 👋 I've published a dev tag with this fix so it can be tested before merging/release. You can install and try it using: Please let me know if everything works as expected or if you notice any issues. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using jira.js v5.x with CommonJS (
require('jira.js')), callingissueAttachments.addAttachment()fails with:The library depended on
mime@^4.1.0, which is ESM-only;require('mime')in the CJS bundle does not expose.getType().Solution
mimewithmime-types, which works in both ESM and CJS.mimeTypes.lookup(filename)directly inversion2/issueAttachments,version3/issueAttachments, andserviceDesk/serviceDeskfor MIME type detection.Changes
mimedependency; addedmime-typesand@types/mime-types.Closes #416