UNPKG

@aliretail/vite-config-xixi

Version:

瓴羊客服vite配置脚手架

51 lines (50 loc) 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path = require("path"); const externals_1 = require("../externals"); const util_1 = require("../util"); async function configBuild({ build, } = {}) { if (build?.lib && build.lib.formats) { console.warn(`[build.lib.format] 不支持配置`); } const pkg = await (0, util_1.readPackage)(); const rollupOptions = { external: await (0, externals_1.fetchExternals)(), output: { sourcemapPathTransform: (relativeSourcePath, sourcemapPath) => { return path.relative(process.cwd(), path.resolve(path.dirname(sourcemapPath), relativeSourcePath)); }, format: 'amd', amd: { id: pkg.name, }, dir: 'dist', entryFileNames: '[name].js', assetFileNames: assetInfo => { if (assetInfo.name === 'style.css') return 'index.css'; return 'assets/[name]-[hash][extname]'; }, }, }; return { build: { cssCodeSplit: false, lib: { entry: path.join(process.cwd(), 'src/index.ts'), name: pkg.name, formats: ['umd'], }, target: 'chrome72', rollupOptions, commonjsOptions: { transformMixedEsModules: true, }, sourcemap: false, }, // plugins: [buildBundleInfo({ // dest: 'dist', // })], }; } exports.default = configBuild;