diff --git a/src/webpack/index.ts b/src/webpack/index.ts index 2844b2b3..b366b6b2 100644 --- a/src/webpack/index.ts +++ b/src/webpack/index.ts @@ -49,11 +49,7 @@ export function getWebpackPlugin ( // transform hook if (plugin.transform) { const useLoader: RuleSetUseItem[] = [{ - loader: TRANSFORM_LOADER, - ident: plugin.name, - options: { - unpluginName: plugin.name - } + loader: `${TRANSFORM_LOADER}?unpluginName=${encodeURIComponent(plugin.name)}` }] const useNone: RuleSetUseItem[] = [] compiler.options.module.rules.push({ diff --git a/src/webpack/loaders/transform.ts b/src/webpack/loaders/transform.ts index 614d8b61..bb773ce3 100644 --- a/src/webpack/loaders/transform.ts +++ b/src/webpack/loaders/transform.ts @@ -4,7 +4,15 @@ import { createContext } from '../context' export default async function transform (this: LoaderContext, source: string, map: any) { const callback = this.async() - const { unpluginName } = this.query + + let unpluginName + if (typeof this.query === 'string') { + const query = new URLSearchParams(this.query) + unpluginName = query.get('unpluginName') + } else { + unpluginName = this.query.unpluginName + } + const plugin = this._compiler?.$unpluginContext[unpluginName] if (!plugin?.transform) {