#base of "./" causes href and src base to be "/./"

11 messages · Page 1 of 1 (latest)

twilit walrus
#

final build file

<!DOCTYPE html><html lang="en"> <head><meta charset="utf-8"><link rel="icon" type="image/svg+xml" href="/favicon.svg"><meta name="viewport" content="width=device-width"><meta name="generator" content="Astro v4.11.6"><title>slime-quest</title><link rel="stylesheet" href="/./_astro/index.DyrCUl9N.css"><script type="module" src="/./_astro/hoisted.kr5gRgDX.js"></script></head> <body>  </body> </html>

astro config

import { defineConfig } from "astro/config";

import { viteSingleFile } from "vite-plugin-singlefile";

import tailwind from "@astrojs/tailwind";

// https://astro.build/config
export default defineConfig({
  integrations: [
    tailwind(),
    viteSingleFile({ useRecommendedBuildConfig: true }),
  ],
  base: "./",
  trailingSlash: "ignore",
});

the html should use ./ for importing in src and href instead of /./ eg
correct

<script type="module" src="./_astro/hoisted.kr5gRgDX.js">

incorrect

<script type="module" src="/./_astro/hoisted.kr5gRgDX.js">
brittle schooner
#

Can you reproduce this in a StackBlitz? You should probably file a bug report.
Question though... why are you specifying a base of current path?
Also, "ignore" is the default for trailingSlash

twilit walrus
#

this is because the app shouldnt be running in the root

#

but also should be able to just run locally

#

if you build and check the index file in dist you will see it imports from /./

#

not ./

dusky lake
#

Are you trying to run it locally at / for development but have a different base for production? If so, you should be able to omit the base all together and define your base via the --base flag during your build step: pnpm build --base /your-sub-directory
(replace pnpm with your package manager)

twilit walrus
#

what if i was going to upload to itch.io for example (i would use astro and kaplay)

dusky lake
#

Unfortunately, I have not used either of those. Are you building a js game inside of astro, or just the site for the game?

twilit walrus
#

the game