From 867cbbdbe4db442f11968b4ed5327547864f84d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Wed, 24 Nov 2021 11:32:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8C=85=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.dev.js | 8 ++++---- build.prod.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.dev.js b/build.dev.js index 5a5e65a..608db03 100644 --- a/build.dev.js +++ b/build.dev.js @@ -107,6 +107,10 @@ function mkWCFile({ style, html, js }) { .replace('watch() {', 'attributeChangedCallback(name, old, val) {\nif (old === val) {return}') .replace('adopted()', 'adoptedCallback()') + js += `if(!customElements.get('wc-${parseName(name)}')){ + customElements.define('wc-${parseName(name)}', ${name}) + }` + return transform(js, ESBUILD_OPTIONS).then(res => { return `/** * @@ -117,10 +121,6 @@ function mkWCFile({ style, html, js }) { */ ${res.code} - -if(!customElements.get('wc-${parseName(name)}')){ - customElements.define('wc-${parseName(name)}', ${name}) -} ` }) } diff --git a/build.prod.js b/build.prod.js index 2471c62..6aeb47b 100644 --- a/build.prod.js +++ b/build.prod.js @@ -114,6 +114,10 @@ function mkWCFile({ style, html, js }) { .replace('watch() {', 'attributeChangedCallback(name, old, val) {\nif (old === val) {return}') .replace('adopted()', 'adoptedCallback()') + js += `if(!customElements.get('wc-${parseName(name)}')){ + customElements.define('wc-${parseName(name)}', ${name}) + }` + return transform(js, ESBUILD_OPTIONS).then(res => { return `/** * @@ -124,10 +128,6 @@ function mkWCFile({ style, html, js }) { */ ${res.code} - -if(!customElements.get('wc-${parseName(name)}')){ - customElements.define('wc-${parseName(name)}', ${name}) -} ` }) }