codecentric / single-page-application-server

Base image and Helm chart for serving Single Page Applications (SPAs)
https://hub.docker.com/r/codecentric/single-page-application-server
MIT License
14 stars 5 forks source link

Support custom hashed file name formats #12

Open PSanetra opened 6 months ago

PSanetra commented 6 months ago

Some bundlers like rollup (also implicitly used by vite) use other file name formats by default, which are not supported by single-page-application-server at the moment. It would be nice optionally to support other file names formats.

See https://rollupjs.org/configuration-options/#output-hashcharacters and https://rollupjs.org/configuration-options/#output-chunkfilenames

As a workaround for vite I recommend to adjust the rollupOptions to use hex as hash-characters and adjust the filenames formats like documented in the rollupjs documentation:

Example:

export default defineConfig(({ mode, command }) => {
  return {
    build: {
      rollupOptions: {
        output: {
          hashCharacters: 'hex',
          entryFileNames: `assets/[name].[hash].js`,
          chunkFileNames: `assets/[name].[hash].js`,
          assetFileNames: `assets/[name].[hash].[ext]`
        }
      },
      [...]
    },
    [...]
  };
});
PSanetra commented 1 month ago

The same issue applies to Angular since angular-cli application builder is based on rollup.js since v17. Currently I see no way in customizing the filename formats.