Passed
Push — v1 ( ec44c1...8d7e7a )
by Andrew
22:13 queued 15:20
created

buildchain/vite.config.ts   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 70
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 51
mnd 1
bc 1
fnc 0
dl 0
loc 70
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
import {defineConfig} from 'vite';
2
import vue from '@vitejs/plugin-vue'
3
import ViteRestart from 'vite-plugin-restart';
4
import viteCompression from 'vite-plugin-compression';
5
import manifestSRI from 'vite-plugin-manifest-sri';
6
import {visualizer} from 'rollup-plugin-visualizer';
7
import eslintPlugin from 'vite-plugin-eslint';
8
import {nodeResolve} from '@rollup/plugin-node-resolve';
9
import * as path from 'path';
10
11
// https://vitejs.dev/config/
12
export default defineConfig(({command}) => ({
13
  base: command === 'serve' ? '' : '/dist/',
14
  build: {
15
    emptyOutDir: true,
16
    manifest: true,
17
    outDir: '../src/web/assets/dist',
18
    rollupOptions: {
19
      input: {
20
        app: 'src/js/app.ts',
21
        welcome: 'src/js/welcome.ts',
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
    vue(),
40
    viteCompression({
41
      filter: /\.(js|mjs|json|css|map)$/i
42
    }),
43
    manifestSRI(),
44
    visualizer({
45
      filename: '../src/web/assets/dist/stats.html',
46
      template: 'treemap',
47
      sourcemap: true,
48
    }),
49
    eslintPlugin({
50
      cache: false,
51
    }),
52
  ],
53
  publicDir: '../src/web/assets/public',
54
  resolve: {
55
    alias: {
56
      '@': path.resolve(__dirname, './src')
57
    },
58
    preserveSymlinks: true,
59
  },
60
  server: {
61
    fs: {
62
      strict: false
63
    },
64
    host: '0.0.0.0',
65
    origin: 'http://localhost:3001/',
66
    port: 3001,
67
    strictPort: true,
68
  }
69
}));
70