-1

For my specific condition I don't want to generate hash in file name for some specific files. I tried something like this, but its removing hash from .css files but not for the .js files.

  build: {
    target: 'es2020',
    rollupOptions: {
      input: {
        main: fileURLToPath(new URL('./index.html', import.meta.url)),
        myapp: fileURLToPath(new URL('./src/my-app.ts', import.meta.url))
      },
      output: {
        assetFileNames: (assetInfo) => {
          if (assetInfo.name?.toLocaleLowerCase().includes('myapp')) {
            return 'assets/[name][extname]';            
          }
          return 'assets/[name]-[hash][extname]';
        },
      },
coure2011
  • 40,286
  • 83
  • 216
  • 349
  • I would debug the assetFileNames function to see if asseInfo includes the necessary fields. Are you already tried? – Max Pattern Jun 27 '22 at 08:30

1 Answers1

1

Use method entryFileNames as its the entry file. https://rollupjs.org/guide/en/#outputentryfilenames

FarazShuja
  • 2,287
  • 2
  • 23
  • 34