Passed
Push — develop ( 31af39...1ae34d )
by Andrew
26:09 queued 20:25
created

buildchain/vite.config.js   A

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 59
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 43
c 0
b 0
f 0
dl 0
loc 59
rs 10
mnd 1
bc 1
fnc 1
bpm 1
cpm 2
noi 0
1
import { createVuePlugin } from 'vite-plugin-vue2'
2
import ViteRestart from 'vite-plugin-restart';
3
import { nodeResolve } from '@rollup/plugin-node-resolve';
4
import path from 'path';
5
6
// https://vitejs.dev/config/
7
export default ({ command }) => ({
8
  base: command === 'serve' ? '' : '/dist/',
9
  build: {
10
    emptyOutDir: true,
11
    manifest: true,
12
    outDir: '../src/web/assets/dist',
13
    rollupOptions: {
14
      input: {
15
        'alerts': 'src/js/alerts.js',
16
        'dashboard': 'src/js/dashboard.js',
17
        'errors-detail': 'src/js/errors-detail.js',
18
        'errors-index': 'src/js/errors-index.js',
19
        'performance-detail': 'src/js/performance-detail.js',
20
        'performance-index': 'src/js/performance-index.js',
21
        'sidebar': 'src/js/sidebar.js',
22
        'webperf': 'src/js/webperf.js',
23
      },
24
      output: {
25
        sourcemap: true
26
      },
27
    }
28
  },
29
  plugins: [
30
    nodeResolve({
31
      moduleDirectories: [
32
         path.resolve('./node_modules'),
33
      ],
34
    }),
35
    ViteRestart({
36
      reload: [
37
          './src/templates/**/*',
38
      ],
39
    }),
40
    createVuePlugin(),
41
  ],
42
  publicDir: '../src/web/assets/public',
43
  resolve: {
44
    alias: {
45
      '@': path.resolve(__dirname, './src'),
46
      'vue': 'vue/dist/vue.esm.js',
47
    },
48
    preserveSymlinks: true,
49
  },
50
  server: {
51
    fs: {
52
      strict: false
53
    },
54
    host: '0.0.0.0',
55
    origin: 'http://localhost:3001/',
56
    port: 3001,
57
    strictPort: true,
58
  }
59
});
60