Skip to content
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

feat: Do not add default plugins to Vite #2451

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions waspc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@

- Renamed and split `deserializeAndSanitizeProviderData` to `getProviderData` and `getProviderDataWithPassword` so it's more explicit if the resulting data will contain the hashed password or not.

- Deleted default `react` plugin in autogenerated vite.config.ts due to conflicts with vite's plugin resolution.
All current projects will need to explicitely add the [`@vitejs/plugin-react`](https://www.npmjs.com/package/@vitejs/plugin-react) themselves,
though now you're able to additionally modify the compiler.
Every new project will now generate `vite.config.ts` with following content:

```
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

export default defineConfig({
server: {
open: true,
},
plugins: [react()],
});

```

### 🔧 Small improvements

- Enabled strict null checks for the Wasp SDK which means that some of the return types are more precise now e.g. you'll need to check if some value is `null` before using it.
Expand Down
6 changes: 4 additions & 2 deletions waspc/data/Cli/templates/basic/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { defineConfig } from 'vite'
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

export default defineConfig({
server: {
open: true,
},
})
plugins: [react()],
});
4 changes: 2 additions & 2 deletions waspc/data/Generator/templates/react-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{={= =}=}}
/// <reference types="vitest" />
import { mergeConfig } from "vite";
import react from "@vitejs/plugin-react";
import { defaultExclude } from "vitest/config"

{=# customViteConfig.isDefined =}
Expand All @@ -14,9 +13,10 @@ const _waspUserProvidedConfig = {=& customViteConfig.importIdentifier =}
const _waspUserProvidedConfig = {};
{=/ customViteConfig.isDefined =}

// Plugins should not be defined here due to conflicts, see https://github.com/vitejs/vite/issues/16479
// All plugins should always be defined within base templates and a migration path should be provided.
const defaultViteConfig = {
base: "{= baseDir =}",
plugins: [react()],
optimizeDeps: {
exclude: ['wasp']
},
Expand Down