webpack/webpack · error · Error

Library type "${type}" is not enabled. EnableWasmLoadingPlug

Error message

Library type "${type}" is not enabled. EnableWasmLoadingPlugin need to be used to enable this type of wasm loading. This usually happens through the "output.enabledWasmLoadingTypes" option. If you are using a function as entry which sets "wasmLoading", you need to add all potential library types to "output.enabledWasmLoadingTypes". These types are enabled: ${[...getEnabledTypes(compiler)].join(", ")}

What it means

Before emitting wasm-loading runtime code webpack calls EnableWasmLoadingPlugin.checkEnabled(compiler, type) to confirm the requested backend was registered for this compiler. A chunk or entry can request a wasm loading type via entry.wasmLoading or via runtime requirements; if that type was never added to output.enabledWasmLoadingTypes (or applied through the plugin), the build aborts and lists the types that ARE enabled so the mismatch is obvious.

Source

Thrown at lib/wasm/EnableWasmLoadingPlugin.js:67

	 * without applying additional built-in behavior.
	 * @param {Compiler} compiler the compiler instance
	 * @param {WasmLoadingType} type type of library
	 * @returns {void}
	 */
	static setEnabled(compiler, type) {
		getEnabledTypes(compiler).add(type);
	}

	/**
	 * Verifies that a wasm loading type has been enabled before code generation
	 * attempts to use it.
	 * @param {Compiler} compiler the compiler instance
	 * @param {WasmLoadingType} type type of library
	 * @returns {void}
	 */
	static checkEnabled(compiler, type) {
		if (!getEnabledTypes(compiler).has(type)) {
			throw new Error(
				`Library type "${type}" is not enabled. ` +
					"EnableWasmLoadingPlugin need to be used to enable this type of wasm loading. " +
					'This usually happens through the "output.enabledWasmLoadingTypes" option. ' +
					'If you are using a function as entry which sets "wasmLoading", you need to add all potential library types to "output.enabledWasmLoadingTypes". ' +
					`These types are enabled: ${[...getEnabledTypes(compiler)].join(", ")}`
			);
		}
	}

	/**
	 * Enables the requested wasm loading backend once and applies the
	 * environment-specific plugins that provide its parser, generator, and
	 * runtime support.
	 * @param {Compiler} compiler the compiler instance
	 * @returns {void}
	 */
	apply(compiler) {
		const { type } = this;

View on GitHub (pinned to 318421ea8a)

Solutions

  1. Add the missing type to output.enabledWasmLoadingTypes (e.g. ['fetch','async-node']).
  2. If you use a function entry that sets wasmLoading, enumerate every type the function can return and add all of them to output.enabledWasmLoadingTypes.
  3. For a custom wasm loading backend, apply EnableWasmLoadingPlugin for your type (or call EnableWasmLoadingPlugin.setEnabled(compiler, type)) inside your plugin's apply().

Example fix

// before
module.exports = {
  output: { enabledWasmLoadingTypes: ['fetch'] },
  entry: { main: () => ({ wasmLoading: 'async-node', import: './app' }) }
};

// after
module.exports = {
  output: { enabledWasmLoadingTypes: ['fetch', 'async-node'] },
  entry: { main: () => ({ wasmLoading: 'async-node', import: './app' }) }
};
Defensive patterns

Strategy: validation

Validate before calling

// Validate config before running the compiler: every wasmLoading value any
// entry can produce must appear in output.enabledWasmLoadingTypes.
const KNOWN = new Set(['fetch', 'async-node', 'universal']);
function validateWasmLoading(config) {
  const enabled = new Set(config.output?.enabledWasmLoadingTypes ?? []);
  const seen = new Set();
  const visit = (entry) => {
    if (!entry) return;
    if (typeof entry === 'string') return;
    if (Array.isArray(entry)) return entry.forEach(visit);
    if (typeof entry === 'function') return; // cannot statically know — see tip
    if (entry.wasmLoading) seen.add(entry.wasmLoading);
    if (Array.isArray(entry.import)) entry.import.forEach(visit);
  };
  Object.values(config.entry ?? {}).forEach(visit);
  for (const t of seen) {
    if (!KNOWN.has(t) && !enabled.has(t)) {
      throw new Error(`wasmLoading '${t}' is used by an entry but missing from output.enabledWasmLoadingTypes`);
    }
  }
}

Prevention

When it happens

Trigger: Setting wasmLoading on an entry (or via target) to 'fetch'/'async-node'/'universal' without listing it in output.enabledWasmLoadingTypes; using a function entry that returns different wasmLoading values per runtime without pre-enabling every possible value; a plugin that taps wasm runtime requirements without applying the matching EnableWasmLoadingPlugin.

Common situations: Multi-compiler build where one compiler sets a wasm type not enabled in the shared config; upgrading webpack and relying on a type that used to be default-enabled; target arrays (e.g. ['web','node']) or Module Federation introducing a runtime whose default wasm loading type was not pre-enabled.

Related errors


AI-assisted analysis of webpack/webpack@318421ea8a (2026-08-03). Data as JSON: /data/errors/e909b54609bfadb6.json. Report an issue: GitHub.