Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom hashed file name formats #12

Open
PSanetra opened this issue Mar 12, 2024 · 1 comment
Open

Support custom hashed file name formats #12

PSanetra opened this issue Mar 12, 2024 · 1 comment

Comments

@PSanetra
Copy link
Member

PSanetra commented Mar 12, 2024

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
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant