fix: migrate from mime-types to mime-db#20812
Conversation
🦋 Changeset detectedLatest commit: cf61dd0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This PR is packaged and the instant preview is available (37d0a4c). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@37d0a4c
yarn add -D webpack@https://pkg.pr.new/webpack@37d0a4c
pnpm add -D webpack@https://pkg.pr.new/webpack@37d0a4c |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #20812 +/- ##
==========================================
+ Coverage 91.39% 91.41% +0.02%
==========================================
Files 560 561 +1
Lines 55307 55359 +52
Branches 14596 14610 +14
==========================================
+ Hits 50548 50607 +59
+ Misses 4759 4752 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR migrates webpack’s internal MIME type handling from the external mime-types package to direct use of mime-db, aiming to reduce dependency size and update an outdated dependency.
Changes:
- Replace
mime-typesdependency withmime-dband update TypeScript type packages accordingly. - Introduce
lib/util/mimeTypes.jsas an internal helper implementinglookup()/extension()on top ofmime-db. - Update
AssetGeneratorandTemplatedPathPluginto use the new internal helper.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Swaps mime-types for mime-db and updates @types/* packages. |
yarn.lock |
Reflects the dependency/type changes and adds mime-db@^1.54.0 resolution. |
lib/util/mimeTypes.js |
Adds an internal MIME lookup/extension helper backed by mime-db. |
lib/TemplatedPathPlugin.js |
Uses internal MIME helper for data-URI extension inference. |
lib/asset/AssetGenerator.js |
Uses internal MIME helper for data URL MIME type resolution; updates JSDoc type. |
.changeset/full-months-jog.md |
Declares a patch changeset for the migration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merging this PR will degrade performance by 45.31%
Performance Changes
Comparing |
Summary
reduce deps size and update outdated dep
What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Existing
Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Nothing
Use of AI
No