title: Sapper/Svelte.js - How to specify client-side assets location?
body: <p>I have a Sapper.js application that I have successfully running on AWS Lambda. Lambda is able to deliver the server-side generated HTML created by Sapper to AWS API Gateway which then serves the app to the user. I am using S3 to host the client side assets (scripts, webpack chunks, etc). The S3 bucket is on a different domain than API Gateway.</p>
  
  <p>The issue I'm having is that I need to set an asset prefix for these scripts so that Sapper can find them. Currently all of my client side scripts include relative links and look like this: <code>&lt;script src="/client/be33a1fe9c8bbaa6fa9d/SCRIPT_NAME.js"&gt;&lt;/script&gt;</code> I need to have them look like this: <code>&lt;script src="https://AWS_S3_BUCKET_ENDPOINT.com/client/be33a1fe9c8bbaa6fa9d/SCRIPT_NAME.js"&gt;&lt;/script&gt;</code></p>
  
  <p>Looking in the <a href="https://sapper.svelte.dev/docs#Base_URLs" rel="nofollow noreferrer">Sapper docs</a>, I see that I can specify a base url for the client and server. However, changing this base url breaks my app and causes the Lambda rendering the pages to return <code>404</code> errors.</p>
  
  <p>I know that when using, say, Next.js, I can accomplish this by modifying the <code>next.config.js</code> file to include the following:</p>
  
  <pre><code>module.exports = {
    assetPrefix: "https://AWS_S3_BUCKET_ENDPOINT.com/client",
  }
  </code></pre>
  
  <p>But I don't know how to do this in Sapper. Do I need to modify the bundler (using webpack) config? Or is there some other way? </p>
  
  <p>Thank you.</p>