Skip to content

Instantly share code, notes, and snippets.

@arielff3
Last active December 22, 2022 19:22
Show Gist options
  • Save arielff3/36dfd0a602bfc11604f0b3da1aac3d4f to your computer and use it in GitHub Desktop.
Save arielff3/36dfd0a602bfc11604f0b3da1aac3d4f to your computer and use it in GitHub Desktop.
import { resolve } from 'node:path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tsConfigPaths from 'vite-tsconfig-paths'
import EsLint from 'vite-plugin-linter'
const { EsLinter, linterPlugin } = EsLint
import dts from 'vite-plugin-dts'
import * as packageJson from './package.json'
// https://vitejs.dev/config/
export default defineConfig(configEnv => ({
plugins: [
react(), // Plugin para o React
tsConfigPaths(), // Plugin para resolver os caminhos do tsconfig.json
linterPlugin({
linters: [new EsLinter({ configEnv })], // Linters
include: ['./src/**/*.{ts,tsx}'], // Caminho para os arquivos de entrada
}),
dts({
include: ['src/components/'], // Caminho para os arquivos de entrada
}),
],
build: {
lib: {
entry: resolve('src', 'components/index.ts'), // Caminho para o arquivo de entrada
name: 'design-system-article', // Nome da biblioteca
formats: ['es', 'umd'], // Formatos de saída
fileName: format => `design-system-article.${format}.js`, // Nome do arquivo de saída
},
rollupOptions: {
external: [...Object.keys(packageJson.peerDependencies)], // Lista de dependências externas
},
},
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment