import { defineConfig } from "vite"; import path from "path"; import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ esbuild: { /** * Prevents ESBuild to throw when using a feature not supported by the * list of supported browsers coming from the `browserslist` file. */ supported: { "top-level-await": true, }, }, build: { lib: { entry: path.resolve("src", "index.tsx"), name: "react18-file-viewer", fileName: (format) => `react18-file-viewer.${format}.js`, }, rollupOptions: { external: ["react", "react-dom"], output: { globals: { react: "React", }, }, }, }, plugins: [react()], });