#React with Vite, 404 on assets.

3 messages · Page 1 of 1 (latest)

dense parrot
#

Hi.

I'm trying to deploy a website onto Amplify hosting. It's built using BrowserRouter and I've got the redirects configured.

When I load the page, <site>/index.html loads, but all of the assets (created via Vite and successfully uploaded according to the build/deploy process) get a 404.

I downloaded the assets.zip from the build phase and sure enough, my index.html and assets/<file>.js and assets/<file>.css are in there.

I'm not actually sure where to look next as there is very limited information.

#

Some further information: vite.config.ts

export default defineConfig({
  plugins: [react()],
  base: '/react-antd/',
  publicDir: '/react-antd/',
  // define: {
  //   "global": {},
  // },
  resolve: {
    alias: [
      {
            find: "./runtimeConfig",
            replacement: ("./runtimeConfig.browser"),
      },
    ],
  },
})```
#

After the build/deploy and when I visit the site, the index.html contains:

  <link rel="stylesheet" href="/react-antd/assets/index-a4a72569.css">```

I get a 200 and can view this in my browser.

I get 404s for both of these files: