From 5f4aeb42376abf7ac2fbc51a7703de4094918356 Mon Sep 17 00:00:00 2001 From: Xu Yiming Date: Tue, 27 Aug 2024 20:43:09 +0800 Subject: [PATCH] fix: Fix type errors --- src/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7c545cc..59671ed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,6 +9,11 @@ export interface IPreactRefreshRspackPluginOptions { }; } +interface NormalizedPluginOptions extends IPreactRefreshRspackPluginOptions { + include: NonNullable; + exclude: NonNullable; +} + const PREACT_PATHS = [ 'preact', 'preact/compat', @@ -56,8 +61,9 @@ const NAME = 'PreactRefreshRspackPlugin'; class PreactRefreshRspackPlugin implements RspackPluginInstance { name = NAME; + private options: NormalizedPluginOptions; - constructor(private options: IPreactRefreshRspackPluginOptions) { + constructor(options: IPreactRefreshRspackPluginOptions) { this.options = { include: options?.include ?? /\.([jt]sx?)$/, exclude: options?.exclude ?? /node_modules/, @@ -93,7 +99,6 @@ class PreactRefreshRspackPlugin implements RspackPluginInstance { compiler.options.module.rules.unshift({ include: this.options.include, exclude: { - or: [this.options.exclude, ...INTERNAL_PATHS].filter(Boolean), }, use: 'builtin:preact-refresh-loader',