import type { Chain } from "../types"

export const generateViteConfigForSolana = (selectedChains: Chain[]) => {
	const hasSolana = selectedChains.some((chain) => chain.name === "Solana")

	if (!hasSolana) {
		return `import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
})`
	}

	return `import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { nodePolyfills } from 'vite-plugin-node-polyfills'

export default defineConfig({
  plugins: [
    react(),
    nodePolyfills({
      exclude: [],
      globals: {
        Buffer: true,
        global: true,
        process: true,
      },
      protocolImports: true,
    }),
  ],
  resolve: {
    alias: {},
  },
})`
}
