From 925512e1636027df31ca29026d46a1f5c1c23982 Mon Sep 17 00:00:00 2001 From: GuoJikun Date: Sat, 7 Oct 2023 14:57:39 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20es=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=94=B9=E4=B8=BA.mjs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ package.json | 21 ++++----------------- src/components/preview-image/index.ts | 12 ++++++------ vite.config.lib.ts | 8 +++++++- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 825c32f..1a58814 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,3 @@ # Changelog + +## [Unreleased] diff --git a/package.json b/package.json index 65ea0b8..e9c81c8 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,11 @@ { "name": "fox-preview-image", "description": "一个支持vue2和vue3的预览图片组件", - "version": "2.7.2", - "main": "lib/preview-image-umd.js", - "module": "lib/preview-image-es.js", - "browser": "lib/preview-image-umd.js", + "version": "2.8.0", + "main": "lib/preview-image.js", + "module": "lib/preview-image.mjs", + "browser": "lib/preview-image.js", "types": "types/components/preview-image/index.d.ts", - "exports": { - ".": { - "require": "./lib/preview-image-umd.js", - "import": "./lib/preview-image-es.js", - "browser": "./lib/preview-image-umd.js", - "types": "./types/components/preview-image/index.d.ts" - }, - "./lib/style.css": { - "require": "./lib/style.css", - "import": "./lib/style.css", - "browser": "./lib/style.css" - } - }, "keywords": [ "frontend", "previewImage", diff --git a/src/components/preview-image/index.ts b/src/components/preview-image/index.ts index 8e7169e..89fe977 100644 --- a/src/components/preview-image/index.ts +++ b/src/components/preview-image/index.ts @@ -1,10 +1,10 @@ -import PreviewImage from "./src/index.vue"; -import { App } from "vue"; +import PreviewImage from './src/index.vue' +import type { App } from 'vue' const install = (app: App) => { - app.component(PreviewImage.name, PreviewImage); -}; + app.component(PreviewImage.name, PreviewImage) +} -export default install; +export default install -export const FoxPreviewImage = PreviewImage; +export const FoxPreviewImage = PreviewImage diff --git a/vite.config.lib.ts b/vite.config.lib.ts index ec9a538..6ef12af 100644 --- a/vite.config.lib.ts +++ b/vite.config.lib.ts @@ -28,7 +28,13 @@ export default defineConfig({ lib: { entry: resolve(__dirname, './src/components/preview-image/index.ts'), name: 'foxPreviewImage', - fileName: (format) => `preview-image-${format}.js`, + fileName: (format) => { + if (format === 'es') { + return 'preview-image.mjs' + } else { + return `preview-image.js` + } + }, formats: ['umd', 'es'] }, cssCodeSplit: false