Skip to content

Commit

Permalink
✨ feat: es格式改为.mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoJikun committed Oct 7, 2023
1 parent d517fbb commit 925512e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Changelog

## [Unreleased]
21 changes: 4 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 6 additions & 6 deletions src/components/preview-image/index.ts
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion vite.config.lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 925512e

Please sign in to comment.