Home > @lynx-js/rspeedy > Filename > js

Filename.js property

The name of the JavaScript files.

Signature:

js?: Rspack.Filename | undefined;

Remarks

Default values:

  • Development: '[name].js' - Production: '[name].[contenthash:8].js'

Example

  • Using a function to dynamically set the filename based on the file information:
import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  output: {
    filename: {
      js: (pathData, assetInfo) => {
        console.log(pathData); // You can check the contents of pathData here

        if (pathData.chunk?.name === 'index') {
          return isProd ? '[name].[contenthash:8].js' : '[name].js';
        }
        return '/some-path/[name].js';
      },
    },
  },
})
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.