From e55ce49060e8aab36db34b9737439309c1b592ce Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Wed, 3 Jan 2024 18:32:52 +1100 Subject: [PATCH] docs: Tweak Vite build instructions (#11) * docs: Tweak Vite build instructions * Add back caveats --- docs/build.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/build.md b/docs/build.md index 3a70205..1227a65 100644 --- a/docs/build.md +++ b/docs/build.md @@ -41,23 +41,25 @@ The build config is quite opinionated, as it is designed to work with our intern ## vite.config.ts -- Wrap your `defineConfig` in `mergeConfig` (also exported from Vite). -- Add `tanstackBuildConfig` into `mergeConfig`. -- Note: Please avoid modifying `build` in your own `defineConfig`. +- Import `mergeConfig` and `tanstackBuildConfig`. +- Merge your custom config first, followed by `tanstackBuildConfig`. +- Please avoid modifying `build` in your custom config. - See an example below: ```ts import { defineConfig, mergeConfig } from 'vite' import { tanstackBuildConfig } from '@tanstack/config/build' +const config = defineConfig({ + // Framework plugins, vitest config, etc. +}) + export default mergeConfig( + config, tanstackBuildConfig({ entry: 'src/index.ts', srcDir: 'src', }), - defineConfig({ - // Add any custom options here, such as framework plugins - }), ) ```