Skip to content

Commit

Permalink
fix: deps on webpack-sources instead of webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 15, 2022
1 parent 0a86b05 commit 5f14fa8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"dependencies": {
"chokidar": "^3.5.3",
"webpack-sources": "^3.2.3",
"webpack-virtual-modules": "^0.4.3"
},
"devDependencies": {
Expand All @@ -39,6 +40,7 @@
"@types/express": "^4.17.13",
"@types/fs-extra": "^9.0.13",
"@types/node": "^17.0.21",
"@types/webpack-sources": "^3.2.0",
"bumpp": "^7.1.1",
"conventional-changelog-cli": "^2.2.2",
"enhanced-resolve": "^5.9.2",
Expand Down
17 changes: 16 additions & 1 deletion pnpm-lock.yaml

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

6 changes: 4 additions & 2 deletions src/webpack/genContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { resolve } from 'path'
import { sources } from 'webpack'
// eslint-disable-next-line import/named
import { RawSource } from 'webpack-sources'
import type { Compilation } from 'webpack'
import type { UnpluginBuildContext } from 'src'

Expand All @@ -17,7 +18,8 @@ export default function genContext (compilation: Compilation):UnpluginBuildConte
outFileName,
// @ts-ignore
sources
? new sources.RawSource(
? new RawSource(
// @ts-expect-error types mismatch
typeof emittedFile.source === 'string'
? emittedFile.source
: Buffer.from(emittedFile.source)
Expand Down

0 comments on commit 5f14fa8

Please sign in to comment.