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

Method checkEnabled

lib/library/EnableLibraryPlugin.js:66–76  ·  view source on GitHub ↗

* Checks enabled. * @param {Compiler} compiler the compiler instance * @param {LibraryType} type type of library * @returns {void}

(compiler, type)

Source from the content-addressed store, hash-verified

64 * @returns {void}
65 */
66 static checkEnabled(compiler, type) {
67 if (!getEnabledTypes(compiler).has(type)) {
68 throw new Error(
69 `Library type "${type}" is not enabled. ` +
70 "EnableLibraryPlugin need to be used to enable this type of library. " +
71 'This usually happens through the "output.enabledLibraryTypes" option. ' +
72 'If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". ' +
73 `These types are enabled: ${[...getEnabledTypes(compiler)].join(", ")}`
74 );
75 }
76 }
77
78 /**
79 * Applies the plugin by registering its hooks on the compiler.

Callers 1

Calls 2

getEnabledTypesFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected