Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 67 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import {defineConfig} from 'vite'; |
||
2 | import createVuePlugin from '@vitejs/plugin-vue'; |
||
3 | import viteCompressionPlugin from 'vite-plugin-compression'; |
||
4 | import viteEslintPlugin from 'vite-plugin-eslint'; |
||
5 | import viteStylelintPlugin from 'vite-plugin-stylelint'; |
||
6 | import viteRestartPlugin from 'vite-plugin-restart'; |
||
7 | import {visualizer} from 'rollup-plugin-visualizer'; |
||
8 | import * as path from 'path'; |
||
9 | |||
10 | // https://vitejs.dev/config/ |
||
11 | export default defineConfig(({command}) => ({ |
||
12 | base: command === 'serve' ? '' : '/dist/', |
||
13 | build: { |
||
14 | emptyOutDir: true, |
||
15 | manifest: 'manifest.json', |
||
16 | outDir: '../src/web/assets/dist', |
||
17 | rollupOptions: { |
||
18 | input: { |
||
19 | app: 'src/js/app.ts', |
||
20 | welcome: 'src/js/welcome.ts', |
||
21 | }, |
||
22 | output: { |
||
23 | sourcemap: true |
||
24 | }, |
||
25 | } |
||
26 | }, |
||
27 | plugins: [ |
||
28 | viteRestartPlugin({ |
||
29 | reload: [ |
||
30 | '../src/templates/**/*', |
||
31 | ], |
||
32 | }), |
||
33 | createVuePlugin(), |
||
34 | viteCompressionPlugin({ |
||
35 | filter: /\.(js|mjs|json|css|map)$/i |
||
36 | }), |
||
37 | visualizer({ |
||
38 | filename: '../src/web/assets/dist/stats.html', |
||
39 | template: 'treemap', |
||
40 | sourcemap: true, |
||
41 | }), |
||
42 | viteEslintPlugin({ |
||
43 | cache: false, |
||
44 | fix: true, |
||
45 | }), |
||
46 | viteStylelintPlugin({ |
||
47 | fix: true, |
||
48 | lintInWorker: true |
||
49 | }) |
||
50 | ], |
||
51 | resolve: { |
||
52 | alias: [ |
||
53 | {find: '@', replacement: path.resolve(__dirname, './src')}, |
||
54 | ], |
||
55 | preserveSymlinks: true, |
||
56 | }, |
||
57 | server: { |
||
58 | fs: { |
||
59 | strict: false |
||
60 | }, |
||
61 | host: '0.0.0.0', |
||
62 | origin: 'http://localhost:' + process.env.DEV_PORT, |
||
63 | port: parseInt(process.env.DEV_PORT), |
||
64 | strictPort: true, |
||
65 | } |
||
66 | })); |
||
67 |