Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
chore(deps): migrate on mime-types package (#209)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: migrate on `mime-types` package, some rare types may have other mimetype
  • Loading branch information
evilebottnawi committed Mar 17, 2020
1 parent f13757a commit fc8721f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -183,8 +183,7 @@ module.exports = {
Type: `String`
Default: `(file extension)`

Sets the MIME type for the file to be transformed. If unspecified the file
extensions will be used to lookup the MIME type.
Sets the MIME type for the file to be transformed. If unspecified the file extensions will be used to lookup the MIME type.

**webpack.config.js**

Expand Down
9 changes: 1 addition & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"loader-utils": "^2.0.0",
"mime": "^2.4.4",
"mime-types": "^2.1.26",
"schema-utils": "^2.6.5"
},
"devDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
@@ -1,6 +1,8 @@
import path from 'path';

import { getOptions } from 'loader-utils';
import validateOptions from 'schema-utils';
import mime from 'mime';
import mime from 'mime-types';

import normalizeFallback from './utils/normalizeFallback';
import schema from './options.json';
Expand Down Expand Up @@ -33,7 +35,7 @@ export default function loader(src) {
// No limit or within the specified limit
if (shouldTransform(options.limit, src.length)) {
const file = this.resourcePath;
const mimetype = options.mimetype || mime.getType(file);
const mimetype = options.mimetype || mime.contentType(path.extname(file));

if (typeof src === 'string') {
// eslint-disable-next-line no-param-reassign
Expand Down

0 comments on commit fc8721f

Please sign in to comment.