To customize your setup, consider the bundler you are using:
If you're working with Vite (Tauri typically uses Vite in most setups):
npm run tauri dev -- --your-variable=1
# this is equivalent to
# vite dev -- --your-variable=1
You can then retrieve this value in your vite.conf.js
file using process.argv
and send it to a custom plugin for build modifications.
For standard nextjs configurations, refer to their documentation:
NODE_OPTIONS='--your-variable=1' next
Note that accessing CLI arguments in nextjs can be a bit challenging.
A simpler approach would be setting up environment variables:
YOUR_VARIABLE=1 npm run tauri dev
You can then access these variables using process.env.YOUR_VARIABLE