-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
72 lines (68 loc) · 1.84 KB
/
Copy pathvite.config.js
File metadata and controls
72 lines (68 loc) · 1.84 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
import FullReload from 'vite-plugin-full-reload';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
build: {
outDir: 'govbr/media',
emptyOutDir: false,
rollupOptions: {
input: {
template: path.resolve(__dirname, 'media/js/template.js'),
'font-awesome': path.resolve(
__dirname,
'node_modules/@fortawesome/fontawesome-free/css/all.min.css'
),
core: path.resolve(__dirname, 'media/js/core.js')
},
output: {
entryFileNames: 'js/[name].js',
assetFileNames: ({ names }) => {
const name = names[0] ?? '';
if (/^fa-.+\.(woff2?|ttf|eot|otf)$/.test(name)) {
return 'webfonts/[name][extname]';
}
if (/\.(woff2?|ttf|eot|otf)$/.test(name))
return 'fonts/[name][extname]';
return '[ext]/[name][extname]';
}
}
},
sourcemap: process.env.NODE_ENV !== 'production'
},
css: {
preprocessorOptions: {
scss: {
// TODO: avaliar a necessidade de silenciar estes avisos do GOVBR DS
silenceDeprecations: ['import', 'color-functions', 'global-builtin', 'if-function']
}
}
},
plugins: [
FullReload([
path.resolve(__dirname, 'govbr/language/**/*.ini'),
path.resolve(__dirname, 'govbr/*.json'),
path.resolve(__dirname, 'govbr/*.xml'),
path.resolve(__dirname, 'govbr/**/*.php')
])
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'media')
}
},
server: {
cors: true,
hmr: {
host: 'localhost'
},
host: '0.0.0.0',
origin: 'http://localhost:5173',
port: 5173,
strictPort: true,
watch: {
usePolling: true
}
}
});