MCPcopy
hub / github.com/webpack/webpack / loaderToIdent

Function loaderToIdent

lib/NormalModuleFactory.js:157–171  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

155 * @returns {string} ident
156 */
157const loaderToIdent = (data) => {
158 if (!data.options) {
159 return data.loader;
160 }
161 if (typeof data.options === "string") {
162 return `${data.loader}?${data.options}`;
163 }
164 if (typeof data.options !== "object") {
165 throw new Error("loader options must be string or object");
166 }
167 if (data.ident) {
168 return `${data.loader}??${data.ident}`;
169 }
170 return `${data.loader}?${JSON.stringify(data.options)}`;
171};
172
173/**
174 * Stringify loaders and resource.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected