Total Complexity | 2 |
Complexity/F | 2 |
Lines of Code | 70 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { createVuePlugin } from 'vite-plugin-vue2' |
||
2 | import ViteRestart from 'vite-plugin-restart'; |
||
3 | import { viteExternalsPlugin } from 'vite-plugin-externals' |
||
4 | import viteCompression from 'vite-plugin-compression'; |
||
5 | import { visualizer } from 'rollup-plugin-visualizer'; |
||
6 | import eslintPlugin from 'vite-plugin-eslint'; |
||
7 | import { nodeResolve } from '@rollup/plugin-node-resolve'; |
||
8 | import path from 'path'; |
||
9 | |||
10 | // https://vitejs.dev/config/ |
||
11 | export default ({ command }) => ({ |
||
12 | base: command === 'serve' ? '' : '/dist/', |
||
13 | build: { |
||
14 | emptyOutDir: true, |
||
15 | manifest: true, |
||
16 | outDir: '../src/web/assets/dist', |
||
17 | rollupOptions: { |
||
18 | input: { |
||
19 | 'imageoptimize': 'src/js/ImageOptimize.js', |
||
20 | 'field': 'src/js/OptimizedImagesField.js', |
||
21 | 'welcome': 'src/js/Welcome.js', |
||
22 | }, |
||
23 | output: { |
||
24 | sourcemap: true |
||
25 | }, |
||
26 | } |
||
27 | }, |
||
28 | plugins: [ |
||
29 | nodeResolve({ |
||
30 | moduleDirectories: [ |
||
31 | path.resolve('./node_modules'), |
||
32 | ], |
||
33 | }), |
||
34 | ViteRestart({ |
||
35 | reload: [ |
||
36 | './src/templates/**/*', |
||
37 | ], |
||
38 | }), |
||
39 | createVuePlugin(), |
||
40 | viteExternalsPlugin({ |
||
41 | 'vue': 'Vue', |
||
42 | }), |
||
43 | viteCompression({ |
||
44 | filter: /\.(js|mjs|json|css|map)$/i |
||
45 | }), |
||
46 | visualizer({ |
||
47 | filename: '../src/web/assets/dist/stats.html', |
||
48 | template: 'treemap', |
||
49 | sourcemap: true, |
||
50 | }), |
||
51 | eslintPlugin(), |
||
52 | ], |
||
53 | publicDir: '../src/web/assets/public', |
||
54 | resolve: { |
||
55 | alias: { |
||
56 | '@': path.resolve(__dirname, './src'), |
||
57 | 'vue': 'vue/dist/vue.esm.js', |
||
58 | }, |
||
59 | preserveSymlinks: true, |
||
60 | }, |
||
61 | server: { |
||
62 | fs: { |
||
63 | strict: false |
||
64 | }, |
||
65 | host: '0.0.0.0', |
||
66 | origin: 'http://localhost:3001/', |
||
67 | port: 3001, |
||
68 | strictPort: true, |
||
69 | } |
||
70 | }); |
||
71 |