UNPKG

@voya-kit/vite-config

Version:

Voya vite config

48 lines (45 loc) 1.54 kB
// rollup.config.js import fs from 'fs'; import typescript from '@rollup/plugin-typescript'; import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import json from '@rollup/plugin-json'; const pkgPath = new URL('./package.json', import.meta.url).pathname; const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); export default { input: 'src/index.ts', output: [ { dir: 'dist', entryFileNames: '[name].mjs', // 指定入口文件的命名规则 chunkFileNames: 'chunk/[name]-[hash].mjs', // 指定非入口chunk的命名规则 format: 'esm', sourcemap: true, inlineDynamicImports: false, // 根据需要决定是否内联动态导入,默认为false }, { dir: 'dist', entryFileNames: '[name].cjs', // 指定入口文件的命名规则 chunkFileNames: 'chunk/[name]-[hash].cjs', // 指定非入口chunk的命名规则 format: 'cjs', sourcemap: true, inlineDynamicImports: false, // 根据需要决定是否内联动态导入,默认为false }, ], plugins: [ resolve(), commonjs(), json(), typescript({ tsconfig: './tsconfig.json', include: ['src/**/*', 'config/**/*', 'plugins/**/*', 'utils/**/*'], exclude: ['node_modules/**', '*.test.ts', '*.spec.ts'], }), ], external: [ 'fsevents', 'lightningcss', ...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {}), ...Object.keys(pkg.devDependencies || {}),], };