From 463f5b3cb79cd62ddad4349c5f8812cf42ba8bba Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 18 Jul 2022 16:20:14 +0800 Subject: [PATCH] Add troubleshooting for `Not Found` error (#1586) Issues with Vite's optimizer --- .../guides/troubleshooting.mdx | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/website/versioned_docs/version-v2.0.0-beta.38/guides/troubleshooting.mdx b/website/versioned_docs/version-v2.0.0-beta.38/guides/troubleshooting.mdx index 4aa119ee..b2b4afeb 100644 --- a/website/versioned_docs/version-v2.0.0-beta.38/guides/troubleshooting.mdx +++ b/website/versioned_docs/version-v2.0.0-beta.38/guides/troubleshooting.mdx @@ -73,4 +73,30 @@ Source: https://github.com/wailsapp/wails/issues/1233 Sometimes the generated Typescript doesn''t have the correct types. To mitigate this, it is possible to specify what types should be generated using the `ts_type` struct tag. For -more details, please read [this](https://github.com/tkrajina/typescriptify-golang-structs#custom-types). \ No newline at end of file +more details, please read [this](https://github.com/tkrajina/typescriptify-golang-structs#custom-types). + +## Page Not found + +When creating multi-page applications (multiple `.html` files), they are not automatically added to `frontend/dist` by Vite, resulting in a `Not Found` error. This is an issue with Vite and not Wails. To manually include files, create a file at `myproject/frontend/vite.config.js` and define rollUp options. An example is provided below: + +``` +// vite.config.js +import { resolve } from 'path' +import { defineConfig } from 'vite' + +export default defineConfig({ + build: { + rollupOptions: { + input: { + main: resolve(__dirname, 'index.html'), + login: resolve(__dirname, 'src/login.html'), + font: resolve(__dirname, 'src/assets/fonts/nunito-v16-latin-regular.woff2'), + } + } + } +}) +``` + +For more details read the Vite documentation here: https://vitejs.dev/guide/build.html#multi-page-app + +Source: https://github.com/wailsapp/wails/issues/1582