-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow customising the Vite config #1465
Changes from 4 commits
5f8fbc5
6da6c69
209a8b3
faddbfb
6ae239c
190fd4f
f51005e
4451b3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,35 @@ | ||
{{={= =}=}} | ||
/// <reference types="vitest" /> | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react-swc' | ||
import { mergeConfig } from "vite"; | ||
import react from "@vitejs/plugin-react-swc"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
{=# customViteConfig.isDefined =} | ||
{=& customViteConfig.importStatement =} | ||
const _waspUserProvidedConfig = {=& customViteConfig.importIdentifier =} | ||
{=/ customViteConfig.isDefined =} | ||
{=^ customViteConfig.isDefined =} | ||
const _waspUserProvidedConfig = {}; | ||
{=/ customViteConfig.isDefined =} | ||
|
||
const defaultViteConfig = { | ||
plugins: [react()], | ||
server: { | ||
port: 3000, | ||
host: '0.0.0.0', | ||
host: "0.0.0.0", | ||
open: true, | ||
}, | ||
envPrefix: 'REACT_APP_', | ||
envPrefix: "REACT_APP_", | ||
build: { | ||
outDir: 'build', | ||
outDir: "build", | ||
}, | ||
test: { | ||
environment: 'jsdom', | ||
setupFiles: ['./src/test/vitest/setup.ts'], | ||
environment: "jsdom", | ||
setupFiles: ["./src/test/vitest/setup.ts"], | ||
}, | ||
}) | ||
}; | ||
|
||
// https://vitejs.dev/config/ | ||
export default mergeConfig( | ||
defaultViteConfig, | ||
_waspUserProvidedConfig | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/.wasp/ | ||
|
||
# We ignore env files recognized and used by Wasp. | ||
.env.server | ||
.env.client | ||
|
||
# To be extra safe, we by default ignore any files with `.env` extension in them. | ||
# If this is too agressive for you, consider allowing specific files with `!` operator, | ||
# or modify/delete these two lines. | ||
*.env | ||
*.env.* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
File marking the root of Wasp project. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
app customViteDemo { | ||
wasp: { | ||
version: "^0.11.5" | ||
}, | ||
title: "custom-vite-demo" | ||
} | ||
|
||
route RootRoute { path: "/", to: MainPage } | ||
page MainPage { | ||
component: import Main from "@client/MainPage.jsx" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Ignore editor tmp files | ||
**/*~ | ||
**/#*# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the built-in Vite helper to merge the objects.