Skip to content

Commit

Permalink
use webpack loader utils package
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuaz committed Aug 14, 2022
1 parent 711a604 commit e025ed8
Show file tree
Hide file tree
Showing 8 changed files with 665 additions and 571 deletions.
724 changes: 434 additions & 290 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@
"@types/node": "^17.0.39",
"find-cache-dir": "^3.3.2",
"json5": "^2.2.1",
"schema-utils": "^4.0.0",
"make-dir": "^3.1.0"
"loader-utils": "^3.2.0",
"make-dir": "^3.1.0",
"schema-utils": "^4.0.0"
},
"devDependencies": {
"@babel/core": "^7.18.2",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { parseOptions, getOutputAndPublicPath, createPlaceholder } from './utils
import { cache } from './cache'
import type { LoaderContext } from 'webpack'

import interpolateName from './interpolateName'
import { interpolateName } from 'loader-utils'
import { parseQuery } from './parseQuery'

import type {
Expand Down Expand Up @@ -70,7 +70,7 @@ export default function loader(this: LoaderContext<Options>, content: string): v
}

const createFile = ({ data, width, height }: AdapterResizeResponse) => {
const fileName = interpolateName(this.resourcePath, this.resourceQuery, name, {
const fileName = interpolateName(this, name, {
context: outputContext,
content: data.toString(),
})
Expand Down
86 changes: 0 additions & 86 deletions src/interpolateName.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/loader-utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'loader-utils' {
export function interpolateName(LoaderContext: any, name: string, options: any): any
}
Loading

0 comments on commit e025ed8

Please sign in to comment.