Skip to content

Instantly share code, notes, and snippets.

@kdembler
Created September 2, 2021 13:47
Show Gist options
  • Save kdembler/0706873c0e0655f923610d811f4d9ecd to your computer and use it in GitHub Desktop.
Save kdembler/0706873c0e0655f923610d811f4d9ecd to your computer and use it in GitHub Desktop.
import { babel } from '@rollup/plugin-babel'
import graphql from '@rollup/plugin-graphql'
import inject from '@rollup/plugin-inject'
import reactRefresh from '@vitejs/plugin-react-refresh'
import path from 'path'
import { visualizer } from 'rollup-plugin-visualizer'
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
reactRefresh(),
babel({
extensions: ['.tsx', '.ts'],
include: ['src/**/*.style.*', 'src/**/*.styles.*'],
plugins: ['@emotion'],
compact: false,
babelHelpers: 'bundled',
}),
graphql(),
{
...inject({
include: ['node_modules/**/*.js*'],
modules: {
Buffer: ['buffer', 'Buffer'],
},
}),
enforce: 'post',
},
{
...visualizer({
filename: 'dist/stats.html',
}),
enforce: 'post',
},
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
optimizeDeps: {
include: ['buffer'],
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment