-
zhangwei
2024-08-21 9efb46fe04b3bb9098e92979ae2c658256446f25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import { visualizer } from "rollup-plugin-visualizer";
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin');
// import commonjs from '@rollup/plugin-commonjs';
 
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    // commonjs(),
    uni(),
    visualizer(),
    new CopyWebpackPlugin({
          patterns: [
              {
                  from: path.join(__dirname,'src/components'),  // 指定要拷贝的文件
                  to: path.join(__dirname,'dist',process.env.NODE_ENV === 'production'?'build':'dev',process.env.UNI_PLATFORM,'cameraBufferJpg'),  // 拷贝到哪个位置
              }
          ]
        })
  ],
  server: {
    port: 5100,
    fs: {
        // Allow serving files from one level up to the project root
        allow: ['..']
    }
},
});