Merge branch 'feat-umd构建' of https://gitee.com/layui-vue/layui-vue into feat-umd构建
This commit is contained in:
		
						commit
						ff726da411
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -4,6 +4,7 @@ dist/
 | 
			
		||||
example/dist/
 | 
			
		||||
lib/
 | 
			
		||||
es/
 | 
			
		||||
umd/
 | 
			
		||||
/types/
 | 
			
		||||
npm-debug.log*
 | 
			
		||||
yarn-debug.log*
 | 
			
		||||
 | 
			
		||||
@ -6,6 +6,8 @@
 | 
			
		||||
  "description": "a component library for Vue 3 base on layui-vue",
 | 
			
		||||
  "homepage": "http://www.layui-vue.com",
 | 
			
		||||
  "main": "es/index.js",
 | 
			
		||||
  "unpkg": "umd/index.js",
 | 
			
		||||
  "jsdelivr": "umd/index.js",
 | 
			
		||||
  "types": "types/index.d.ts",
 | 
			
		||||
  "style": "lib/index.css",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
@ -22,9 +24,10 @@
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "dev": "vite example",
 | 
			
		||||
    "build": "npm run build:all && npm run build:es && npm run build:types && npm run build:example",
 | 
			
		||||
    "build": "npm run build:all && npm run build:es && npm run build:umd && npm run build:types && npm run build:example",
 | 
			
		||||
    "build:es": "vite build --emptyOutDir --config ./script/build.es.ts",
 | 
			
		||||
    "build:all": "vite build --emptyOutDir --config ./script/build.all.ts",
 | 
			
		||||
    "build:umd": "vite build --emptyOutDir --config ./script/build.umd.ts",
 | 
			
		||||
    "build:types": "rimraf types && tsc -d",
 | 
			
		||||
    "build:example": "vite build example",
 | 
			
		||||
    "lint:eslint": "eslint 'src/**/*.{vue,ts,tsx}' --fix",
 | 
			
		||||
@ -85,6 +88,7 @@
 | 
			
		||||
  "files": [
 | 
			
		||||
    "lib",
 | 
			
		||||
    "es",
 | 
			
		||||
    "umd",
 | 
			
		||||
    "types"
 | 
			
		||||
  ],
 | 
			
		||||
  "browserslist": [
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										40
									
								
								script/build.umd.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								script/build.umd.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,40 @@
 | 
			
		||||
import { UserConfigExport } from 'vite'
 | 
			
		||||
import vue from '@vitejs/plugin-vue'
 | 
			
		||||
import { resolve } from 'path'
 | 
			
		||||
 | 
			
		||||
export default (): UserConfigExport => {
 | 
			
		||||
  return {
 | 
			
		||||
    publicDir: false,
 | 
			
		||||
    resolve: {
 | 
			
		||||
      alias: [
 | 
			
		||||
        {
 | 
			
		||||
          find: '@',
 | 
			
		||||
          replacement: resolve(process.cwd(), './')
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    plugins: [
 | 
			
		||||
      vue(),
 | 
			
		||||
    ],
 | 
			
		||||
    build: {
 | 
			
		||||
      cssCodeSplit: false,
 | 
			
		||||
      outDir: 'umd',
 | 
			
		||||
      emptyOutDir: true,
 | 
			
		||||
      lib: {
 | 
			
		||||
        entry: resolve(process.cwd(), './src/index.ts'),
 | 
			
		||||
        name: 'LayuiVue',
 | 
			
		||||
        formats: ['umd'],
 | 
			
		||||
        fileName: (name) => `index.js`
 | 
			
		||||
      },
 | 
			
		||||
      rollupOptions: {
 | 
			
		||||
        output: {
 | 
			
		||||
          globals: {
 | 
			
		||||
            vue: 'Vue'
 | 
			
		||||
          },
 | 
			
		||||
          assetFileNames: 'index.css',
 | 
			
		||||
        },
 | 
			
		||||
        external: ['vue', 'vue-router']
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -250,6 +250,7 @@ export {
 | 
			
		||||
  LayNoticeBar,
 | 
			
		||||
  LayTransition,
 | 
			
		||||
  LayUpload,
 | 
			
		||||
  install,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export { layer };
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user