Skip to content

Add vite-plugin, jsconfig, dev-mode runtime to JS templates #10

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

Merged
merged 16 commits into from
Mar 3, 2025
Merged
Changes from 1 commit
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
Next Next commit
Update react-swc template
  • Loading branch information
IanVS committed Mar 3, 2025
commit e71fd7621d0ab992e46fde7c619cec3a52fcabc2
27 changes: 27 additions & 0 deletions v3/internal/templates/react-swc/frontend/jsconfig.json.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* This file tells your IDE where the root of your JavaScript project is, and sets some
* options that it can use to provide autocompletion and other features.
*
* List of options: https://code.visualstudio.com/docs/languages/jsconfig#_jsconfig-options
*/
{
"compilerOptions": {
"moduleResolution": "bundler",
/**
* The target and module can be set to ESNext to allow writing modern JavaScript,
* and Vite will compile down to the level of "build.target" specified in the vite config file.
* Builds will error if you use a feature that cannot be compiled down to the target level.
*/
"target": "ESNext",
"module": "ESNext",
"resolveJsonModule": true,
/**
* Enable checkJs if you'd like type checking in `.js(x)` files.
*/
"checkJs": false,
"strict": true,
"skipLibCheck": true,
{{if .LocalModulePath}}"customConditions": ["wails-development"],{{end}}
},
"include": ["src/**/*", "bindings/**/*.d.ts"]
}
Original file line number Diff line number Diff line change
@@ -18,6 +18,6 @@
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react-swc": "^3.5.0",
"vite": "^5.0.8",
"@wailsio/runtime": "latest"
"@wailsio/runtime": "{{if .LocalModulePath}}file:../{{.LocalModulePath}}v3/internal/runtime/desktop/@wailsio/runtime{{else}}latest{{end}}"
}
}
1 change: 1 addition & 0 deletions v3/internal/templates/react-swc/frontend/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
7 changes: 0 additions & 7 deletions v3/internal/templates/react-swc/frontend/vite.config.js

This file was deleted.

25 changes: 25 additions & 0 deletions v3/internal/templates/react-swc/frontend/vite.config.js.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { defineConfig } from "vite";
import react from '@vitejs/plugin-react-swc'
import WailsTypedEvents from "@wailsio/runtime/plugins/vite";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
WailsTypedEvents("./bindings"),
],
{{- if .LocalModulePath}}
resolve: {
// Configure the resolution system to import the development version of the runtime package.
// This is only correct when using a development version of wails directly from the repository.
// Otherwise, this option (as well as the matching one in the tsconfig.json file) should be removed.
conditions: ["wails-development"]
},
{{- end}}
build: {
// Wails supports deployment on macOS 10.13 High Sierra,
// whose webview is based on the same runtime as Safari 11.
// If the project targets later macOS versions, this option may be changed or removed.
target: "safari11"
}
})