tauri-docs
tauri-docs copied to clipboard
Add guide: Tauri + Nextjs
Setup
- link to nextjs setup
- link to tauri setup
- explain how to setup nextjs and tauri in one project
- configuration
- configure ecmascript target
- configure conditional compilation env vars
- strict port?
Development
- mention HMR
- best practices when mapping routes to app views?
- any other best practices when targeting desktop apps?
Building
- mention vite build (short)
- explain how tauri build will find the assets
SSG
- explain challenges (no
window
object, no tauri apis) - link to
@tauri-apps/api/mocks
- link to vite SSR guide
- show example config
Plugin recommendations
Does nextjs have plugins? If so what are some good plugins to have? (See vite and rollup guides for examples)
I've set up a barebones template repo for using next.js with tauri here https://github.com/kvnxiao/tauri-nextjs-template
Modified the development / build commands a bit, and keeping in mind that this is meant to use next.js solely as a frontend project scaffolding tool (similar to create-react-app), and not for its additional server-side rendering features. Meaning that it's only meant for SSG consumption and that next/image
optimization is disabled.
screenshot of output build using pre-rendering/SSG (via next build && next export
):
I'm wondering if this can somehow be adapted and integrated directly into the yarn create tauri-app
command sometime in the future?
I'm wondering if this can somehow be adapted and integrated directly into the
yarn create tauri-app
command sometime in the future?
We're working on a re-write in Rust for create-tauri-app that will allow us to create/add a lot more templates, so this is on the roadmap. Can find more details here: https://github.com/tauri-apps/create-tauri-app/issues/77
For the time being you could add it to https://github.com/tauri-apps/awesome-tauri tho.
Hey @JonasKruckenberg I made a getting started in this PR I can also translate it in french if you need i just don't know how, im not familiar with docusaurus!
You can ping me up on the discord channel @leone