From 856b0736dbb658ffd6cf32d246359683b622b36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sun, 4 Jun 2023 03:53:07 +0800 Subject: [PATCH] feat(rspack): support `enforce` --- README.md | 2 +- src/rspack/index.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a6b52fe5..8d4a8139 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Currently supports: | Hook | Rollup | Vite | Webpack 4 | Webpack 5 | esbuild | Rspack | | ----------------------------------------------------------------------- | :-------------: | :--: | :-------: | :-------: | :-------------: | :----: | -| [`enforce`](https://rollupjs.org/guide/en/#enforce) | ❌ 1 | ✅ | ✅ | ✅ | ❌ 1 | ❌ | +| [`enforce`](https://rollupjs.org/guide/en/#enforce) | ❌ 1 | ✅ | ✅ | ✅ | ❌ 1 | ✅ | | [`buildStart`](https://rollupjs.org/guide/en/#buildstart) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | [`resolveId`](https://rollupjs.org/guide/en/#resolveid) | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | `loadInclude`2 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | diff --git a/src/rspack/index.ts b/src/rspack/index.ts index d120973b..5abbb771 100644 --- a/src/rspack/index.ts +++ b/src/rspack/index.ts @@ -40,6 +40,7 @@ export function getRspackPlugin( } compiler.options.module.rules.unshift({ + enforce: plugin.enforce, include: /.*/, use, }) @@ -52,6 +53,7 @@ export function getRspackPlugin( options: { plugin }, } compiler.options.module.rules.unshift({ + enforce: plugin.enforce, include: /.*/, use, })