From 2d9ecccf2b861b648f396020270cc3c358f4b6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E5=B0=91=E5=8D=AB?= Date: Fri, 7 Jun 2024 11:47:41 +0800 Subject: [PATCH] =?UTF-8?q?build(=E4=BA=8C=E7=BB=B4=E7=A0=81):=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E5=A4=B1=E8=B4=A5=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/plugin/BarCodePlugin.ts | 6 +++--- vite.config.ts | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/core/plugin/BarCodePlugin.ts b/packages/core/plugin/BarCodePlugin.ts index ece29146..79273107 100644 --- a/packages/core/plugin/BarCodePlugin.ts +++ b/packages/core/plugin/BarCodePlugin.ts @@ -2,13 +2,13 @@ * @Author: 秦少卫 * @Date: 2024-06-06 14:12:24 * @LastEditors: 秦少卫 - * @LastEditTime: 2024-06-06 21:23:34 + * @LastEditTime: 2024-06-07 11:44:54 * @Description: 条形码生成工具 */ import { fabric } from 'fabric'; import Editor from '../Editor'; -import JsBarcode from 'JsBarcode'; +import 'JsBarcode'; type IEditor = Editor; // 条形码生成参数 @@ -35,7 +35,7 @@ class BarCodePlugin { _getBase64Str(option: any) { const canvas = document.createElement('canvas'); - JsBarcode(canvas, option.value, { + window.JsBarcode(canvas, option.value, { ...option, }); const url = canvas.toDataURL('image/png', 1); diff --git a/vite.config.ts b/vite.config.ts index 28bee36c..7339ad5d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,7 +4,7 @@ * @Author: June * @Date: 2023-04-24 00:25:39 * @LastEditors: 秦少卫 - * @LastEditTime: 2024-06-07 11:35:26 + * @LastEditTime: 2024-06-07 11:45:43 */ import { defineConfig, loadEnv } from 'vite'; import vue from '@vitejs/plugin-vue'; @@ -56,7 +56,6 @@ const config = ({ mode }) => { // sourcemap: !isProd, emptyOutDir: true, rollupOptions: { - external: ['JsBarcode'], input: resolve(__dirname, 'index.html'), output: { chunkFileNames: 'js/[name].[hash].js',