For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /plugins/webpack/enable-chunk-loading-plugin.md.
close

EnableChunkLoadingPlugin

Enable runtime module bundling for this chunkLoadingType, and is used by output.enabledChunkLoadingTypes under the hood.

Examples

Use built-in chunk loading

Available values: "jsonp" | "import-scripts" | "require" | "async-node" | "import"

new rspack.javascript.EnableChunkLoadingPlugin('import');

See output.chunkLoading for details.

Use custom chunk loading

Implement a custom chunk loading plugin using EnableChunkLoadingPlugin.setEnabled:

CustomChunkLoadingPlugin.mjs
import { rspack } from '@rspack/core';

export class CustomChunkLoadingPlugin {
  apply(compiler) {
    rspack.javascript.EnableChunkLoadingPlugin.setEnabled(
      compiler,
      'custom-chunk-loading',
    );
  }
}

Then use output.chunkLoading: 'custom-chunk-loading' in Rspack config:

rspack.config.mjs
import { CustomChunkLoadingPlugin } from './CustomChunkLoadingPlugin.mjs';

export default {
  output: {
    chunkLoading: 'custom-chunk-loading',
  },
  plugins: [new CustomChunkLoadingPlugin()],
};