@@ -77,8 +77,10 @@ type ViteConfigBuildArgs = {
7777
7878type ViteConfigBaseArgs = {
7979 templateName ?: TemplateName ;
80+ base ?: string ;
8081 envDir ?: string ;
8182 mdx ?: boolean ;
83+ vanillaExtract ?: boolean ;
8284} ;
8385
8486type ViteConfigArgs = (
@@ -140,15 +142,18 @@ export const viteConfig = {
140142 ] . join ( "\n" )
141143 }
142144 ${ args . mdx ? 'import mdx from "@mdx-js/rollup";' : "" }
145+ ${ args . vanillaExtract ? 'import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";' : "" }
143146 import { envOnlyMacros } from "vite-env-only";
144147 import tsconfigPaths from "vite-tsconfig-paths";
145148
146149 export default async () => ({
147150 ${ args . port ? await viteConfig . server ( args ) : "" }
148151 ${ viteConfig . build ( args ) }
152+ ${ args . base ? `base: "${ args . base } ",` : "" }
149153 envDir: ${ args . envDir ? `"${ args . envDir } "` : "undefined" } ,
150154 plugins: [
151155 ${ args . mdx ? "mdx()," : "" }
156+ ${ args . vanillaExtract ? "vanillaExtractPlugin({ emitCssInSsr: true })," : "" }
152157 reactRouter(),
153158 envOnlyMacros(),
154159 tsconfigPaths()
@@ -331,6 +336,25 @@ export const reactRouterServe = async ({
331336 return ( ) => serveProc . kill ( ) ;
332337} ;
333338
339+ export const runStartScript = async ( {
340+ cwd,
341+ port,
342+ basename,
343+ } : {
344+ cwd : string ;
345+ port : number ;
346+ basename ?: string ;
347+ } ) => {
348+ let nodeBin = process . argv [ 0 ] ;
349+ let proc = spawn ( nodeBin , [ "start.js" ] , {
350+ cwd,
351+ stdio : "pipe" ,
352+ env : { NODE_ENV : "production" , PORT : port . toFixed ( 0 ) } ,
353+ } ) ;
354+ await waitForServer ( proc , { port, basename } ) ;
355+ return ( ) => proc . kill ( ) ;
356+ } ;
357+
334358export const wranglerPagesDev = async ( {
335359 cwd,
336360 port,
0 commit comments