|
| 1 | +const path = require('path') |
| 2 | +// const fs = require('fs') |
| 3 | +const { build } = require('vite') |
| 4 | +// const Vue = require('@vitejs/plugin-vue') |
| 5 | +// const vueJsx = require('@vitejs/plugin-vue-jsx') |
| 6 | +// const vitePluginMd2Vue = require('vite-plugin-md2vue') |
| 7 | + |
| 8 | +// console.log('build: ', build) |
| 9 | +// console.log('createLogger: ', createLogger) |
| 10 | +// console.log('createServer: ', createServer) |
| 11 | +// console.log('defineConfig: ', defineConfig) |
| 12 | +// console.log('loadConfigFromFile: ', loadConfigFromFile) |
| 13 | +// console.log('loadEnv: ', loadEnv) |
| 14 | +// console.log('mergeConfig: ', mergeConfig) |
| 15 | +// console.log('normalizePath: ', normalizePath) |
| 16 | +// console.log('optimizeDeps: ', optimizeDeps) |
| 17 | +// console.log('resolveConfig: ', resolveConfig) |
| 18 | +// console.log('resolvePackageData: ', resolvePackageData) |
| 19 | +// console.log('resolvePackageEntry: ', resolvePackageEntry) |
| 20 | +// console.log('send: ', send) |
| 21 | +// console.log('sortUserPlugins: ', sortUserPlugins) |
| 22 | + |
| 23 | +// function getEntry(dir) { |
| 24 | +// return fs.readdirSync(path.resolve(dir)) |
| 25 | +// } |
| 26 | + |
| 27 | +// let entry = { |
| 28 | +// base: './src/assets/less/variables.less', |
| 29 | +// index: './src/index.js' |
| 30 | +// }; |
| 31 | +// getEntry('./packages').forEach(function (name) { |
| 32 | +// entry[name] = './packages/' + name + '/index.js' |
| 33 | +// }) |
| 34 | + |
| 35 | +// console.log(Vue) |
| 36 | +// console.log(vueJsx) |
| 37 | +// console.log(vitePluginMd2Vue) |
| 38 | + |
| 39 | +build({ |
| 40 | + // root: path.resolve(__dirname, './'), |
| 41 | + // plugins: [ |
| 42 | + // Vue.default(), |
| 43 | + // vueJsx.default(), |
| 44 | + // vitePluginMd2Vue.default() |
| 45 | + // ], |
| 46 | + build: { |
| 47 | + lib: { |
| 48 | + entry: path.resolve(__dirname, 'src/index.js'), |
| 49 | + name: 'PlMobile' |
| 50 | + }, |
| 51 | + outDir: 'lib', |
| 52 | + rollupOptions: { |
| 53 | + // 确保外部化处理那些你不想打包进库的依赖 |
| 54 | + external: ['vue'], |
| 55 | + // input: entry, |
| 56 | + output: { |
| 57 | + // entryFileNames: '[name].js', |
| 58 | + // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量 |
| 59 | + globals: { |
| 60 | + vue: 'Vue' |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | +}) |
0 commit comments