Passed
Push — develop ( 23539e...9d4d3e )
by Andrew
12:19
created

buildchain/vite.config.ts   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 76
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 56
c 0
b 0
f 0
dl 0
loc 76
rs 10
mnd 1
bc 1
fnc 0
bpm 0
cpm 0
noi 0
1
import {defineConfig} from 'vite';
2
import {createVuePlugin} from 'vite-plugin-vue2'
3
import ViteRestart from 'vite-plugin-restart';
4
import {viteExternalsPlugin} from 'vite-plugin-externals'
5
import viteCompression from 'vite-plugin-compression';
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
        'dashboard': 'src/js/Dashboard.js',
21
        'import': 'src/js/Import.js',
22
        'redirects': 'src/js/Redirects.js',
23
        'retour': 'src/js/Retour.js',
24
        'widget': 'src/js/Widget.js'
25
      },
26
      output: {
27
        sourcemap: true
28
      },
29
    }
30
  },
31
  plugins: [
32
    nodeResolve({
33
      moduleDirectories: [
34
        path.resolve('./node_modules'),
35
      ],
36
    }),
37
    ViteRestart({
38
      reload: [
39
        './src/templates/**/*',
40
      ],
41
    }),
42
    createVuePlugin(),
43
    viteExternalsPlugin({
44
      'vue': 'Vue',
45
    }),
46
    viteCompression({
47
      filter: /\.(js|mjs|json|css|map)$/i
48
    }),
49
    visualizer({
50
      filename: '../src/web/assets/dist/stats.html',
51
      template: 'treemap',
52
      sourcemap: true,
53
    }),
54
    eslintPlugin({
55
      cache: false,
56
    }),
57
  ],
58
  publicDir: '../src/web/assets/public',
59
  resolve: {
60
    alias: {
61
      '@': path.resolve(__dirname, './src'),
62
      'vue': 'vue/dist/vue.esm.js',
63
    },
64
    preserveSymlinks: true,
65
  },
66
  server: {
67
    fs: {
68
      strict: false
69
    },
70
    host: '0.0.0.0',
71
    origin: 'http://localhost:3001/',
72
    port: 3001,
73
    strictPort: true,
74
  }
75
}));
76