import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill';
import path from 'path';

export default defineConfig({
    plugins: [vue()],
    define: {
        // Explizit Produktionsumgebung setzen
        __DEV__: false,
        'import.meta.env.DEV': false,
        'import.meta.env.PROD': true,
        'import.meta.env.MODE': '"production"'
    },
    optimizeDeps: {
        esbuildOptions: {
            plugins: [
                NodeGlobalsPolyfillPlugin({
                    buffer: true
                }),
                NodeModulesPolyfillPlugin()
            ]
        }
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, './src'),
            stream: 'stream-browserify',
            util: 'util',
            assert: 'assert',
        }
    },
})
