From 657bb082225b4217d972b8e47c1c56fbbfc84688 Mon Sep 17 00:00:00 2001 From: meixg Date: Fri, 12 Mar 2021 13:16:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=9A=E6=AC=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=EF=BC=8Cloader=20=E4=BC=9A=E6=B7=BB=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 2 +- src/plugin.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3af0e20..2a7d39b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "san-ssr-plugin", - "version": "0.0.0-development", + "version": "1.1.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/plugin.ts b/src/plugin.ts index 4c12e3a..448f49c 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -44,15 +44,20 @@ export default class SanPhpLoaderPlugin { runtimeHelperOutput: string; outputPath: string; sanSsrOptions: sanSsrOptions; + initialized: boolean; constructor(options?: PluginOptions) { this.runtimeHelperOutput = options?.runtimeHelper?.output || 'runtimeHelpers'; this.outputPath = options?.output?.path || ''; this.sanSsrOptions = options?.output || {}; + this.initialized = false; } apply(compiler: Compiler) { - addStyleLoader(compiler); - addSanLoader(compiler); + if (!this.initialized) { + addStyleLoader(compiler); + addSanLoader(compiler); + this.initialized = true; + } compiler.hooks.compilation.tap(id, compilation => { styleStore.clear();