import * as sst from "@serverless-stack/resources" ; export class MainStack extends sst . Stack { constructor ( scope , id , props ? ) { super ( scope , id , props ) ; const site = new sst . StaticSite ( this , "SPA" , { fileOptions : [ { exclude : "*" , include : "*.html" , cacheControl : "max-age=0,no-cache,no-store,must-revalidate" , } , { exclude : "*" , include : [ "*.js" , "*.css" ] , cacheControl : "max-age=31536000,public,immutable" , } , ] , replaceValues : [ { files : "*.js" , search : "{{ GREETING }}" , replace : "Hi!" , } , { files : "*.html" , search : "{{ GREETING }}" , replace : "Hello World!" , } , ] , path : "src/sites/react-app" , indexPage : "index.html" , buildCommand : "npm run build" , buildOutput : "build" , errorPage : sst . StaticSiteErrorOptions . REDIRECT_TO_INDEX_PAGE , } ) ; this . addOutputs ( { URL : site . url , CustomDomainURL : site . customDomainUrl || "no-custom-domain" , BucketArn : site . bucketArn , BucketName : site . bucketName , DistributionId : site . distributionId , DistributionDomain : site . distributionDomain , } ) ; } }