Skip to content
Discussion options

You must be logged in to vote

I've managed to get TanStack Start working with Serwist. I created a custom Vite plugin:

import path from 'node:path'
import { injectManifest } from '@serwist/build'
import type { Plugin } from 'vite'
import { build } from 'vite'

/**
 * Custom Serwist plugin for TanStack Start
 * Builds service worker in both dev and production modes
 */
export function tanstackSerwistPlugin(): Plugin {
  let rootDir: string
  let isProduction: boolean

  return {
    name: 'tanstack-serwist',
    configResolved(config) {
      rootDir = config.root
      isProduction = config.isProduction
    },
    async buildStart() {
      // Build service worker in dev mode
      if (!isProduction) {
        await b…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by dannylin108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants