-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
33 lines (30 loc) 路 1.18 KB
/
Copy pathvite.config.js
File metadata and controls
33 lines (30 loc) 路 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// inicio file: vite.config.js
// @ts-check
import { defineConfig } from 'vite';
export default defineConfig(({ command }) => {
// Configuraci贸n din谩mica dependiendo del modo
const esProduccion = command === 'build';
return {
build: {
// Keyword: lib
// Justificaci贸n: Le indica a Vite que debe compilar este proyecto como una librer铆a de NPM (ES Modules) usando src/index.js como entrada.
lib: {
entry: 'src/index.js',
name: 'mita-dom',
formats: ['es']
},
// Keyword: 'terser'
// Justificaci贸n: Algoritmo de minificaci贸n que adem谩s ofusca nombres de variables, dificultando la ingenier铆a inversa.
minify: esProduccion ? 'terser' : false,
// Keyword: rollupOptions
// Justificaci贸n: Para librer铆as NPM necesitamos nombres de archivo deterministas y predecibles (sin hashes).
rollupOptions: {
output: {
entryFileNames: 'mita-dom.js',
assetFileNames: 'mita-dom.[ext]',
}
}
}
};
});
// fin file: vite.config.js