chore: make webpack call compactible with 4 and 5

This commit is contained in:
Anthony Fu 2022-08-04 02:44:42 +08:00
parent cfc198d5aa
commit 5e71cd2c6b
3 changed files with 5 additions and 2 deletions

View File

@ -52,6 +52,7 @@
"fs-extra": "^10.1.0",
"jiti": "^1.14.0",
"magic-string": "^0.26.2",
"picocolors": "^1.0.0",
"rollup": "^2.77.2",
"tsup": "^6.2.0",
"typescript": "^4.7.4",

2
pnpm-lock.yaml generated
View File

@ -19,6 +19,7 @@ specifiers:
fs-extra: ^10.1.0
jiti: ^1.14.0
magic-string: ^0.26.2
picocolors: ^1.0.0
rollup: ^2.77.2
tsup: ^6.2.0
typescript: ^4.7.4
@ -52,6 +53,7 @@ devDependencies:
fs-extra: 10.1.0
jiti: 1.14.0
magic-string: 0.26.2
picocolors: 1.0.0
rollup: 2.77.2
tsup: 6.2.0_typescript@4.7.4
typescript: 4.7.4

View File

@ -2,7 +2,7 @@ import * as path from 'path'
import { it, describe, expect, vi, afterEach, Mock } from 'vitest'
import * as vite from 'vite'
import * as rollup from 'rollup'
import { webpack } from 'webpack'
import * as webpack from 'webpack'
import * as esbuild from 'esbuild'
import { createUnplugin, UnpluginOptions } from '../../../src'
@ -83,7 +83,7 @@ describe('resolveId hook', () => {
const plugin = createUnpluginWithCallback(mockResolveIdHook).webpack
await new Promise((resolve) => {
webpack(
(webpack.webpack || webpack)(
{
entry: path.resolve(__dirname, 'test-src/entry.js'),
plugins: [plugin()]