1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import fs from 'fs'
- import { getRollupPlugins } from '../../.build/rollup-plugins.mjs'
- import dts from "rollup-plugin-dts";
- const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'))
- const packageName = '@tabler/icons-vue';
- const outputFileName = 'tabler-icons-vue';
- const outputDir = 'dist';
- const inputs = ['./src/tabler-icons-vue.ts'];
- const bundles = [
- {
- format: 'umd',
- inputs,
- outputDir,
- minify: true,
- },
- {
- format: 'umd',
- inputs,
- outputDir,
- },
- {
- format: 'cjs',
- inputs,
- outputDir,
- },
- {
- format: 'esm',
- inputs,
- outputDir,
- preserveModules: true,
- },
- ];
- const configs = bundles
- .map(({ inputs, outputDir, format, minify, preserveModules }) =>
- inputs.map(input => ({
- input,
- plugins: getRollupPlugins(pkg, minify),
- external: ['vue'],
- output: {
- name: packageName,
- ...(preserveModules
- ? {
- dir: `${outputDir}/${format}`,
- }
- : {
- file: `${outputDir}/${format}/${outputFileName}${minify ? '.min' : ''}.js`,
- }),
- format,
- preserveModules,
- sourcemap: true,
- globals: {
- vue: 'vue',
- },
- },
- })),
- )
- .flat();
- export default [
- {
- input: inputs[0],
- output: [{
- file: `dist/${outputFileName}.d.ts`, format: "es"
- }],
- plugins: [
- dts({
- compilerOptions: {
- preserveSymlinks: false
- }
- })
- ],
- },
- ...configs
- ];
|