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

chore(deps): migrate on mime-types package #209

Merged
merged 2 commits into from Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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