MCPcopy
hub / github.com/webpack/webpack / checkEnabled

Method checkEnabled

lib/wasm/EnableWasmLoadingPlugin.js:65–75  ·  view source on GitHub ↗

* 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}

(compiler, type)

Source from the content-addressed store, hash-verified

63 * @returns {void}
64 */
65 static checkEnabled(compiler, type) {
66 if (!getEnabledTypes(compiler).has(type)) {
67 throw new Error(
68 `Library type "${type}" is not enabled. ` +
69 "EnableWasmLoadingPlugin need to be used to enable this type of wasm loading. " +
70 'This usually happens through the "output.enabledWasmLoadingTypes" option. ' +
71 'If you are using a function as entry which sets "wasmLoading", you need to add all potential library types to "output.enabledWasmLoadingTypes". ' +
72 `These types are enabled: ${[...getEnabledTypes(compiler)].join(", ")}`
73 );
74 }
75 }
76
77 /**
78 * Enables the requested wasm loading backend once and applies the

Callers

nothing calls this directly

Calls 2

getEnabledTypesFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected