Pavel 35980656e3
Add Next.js and Vite examples (#290)
* rename community to with-parcel

* add with-next example

* update example names and unify configs

* add vite example

* use new JSX transform in examples

* disable necessary eslint rules for examples

* add next output to prettierignore

* add remix example

* update engines in package.json

* remove readme from with-next example

* update vite example

* update with-next example

* remove with-remix example
2022-10-10 15:26:44 -05:00

33 lines
800 B
TypeScript

import react from '@vitejs/plugin-react'
import { defineConfig, loadEnv } from 'vite'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
return {
optimizeDeps: {
esbuildOptions: {
target: 'es2020',
},
},
build: {
target: 'es2020',
},
plugins: [react({})],
define: {
/**
* Loads `.env` files and sets `process.env` varibales.
*
* @see https://vitejs.dev/config/#environment-variables
* @see https://vitejs.dev/config/shared-options.html#define
*/
...Object.entries(loadEnv(mode, process.cwd(), '')).reduce(
(variables, [key, value]) => ({
...variables,
[`process.env.${key}`]: `'${value}'`, // notice ''
}),
{}
),
},
}
})