MCPcopy
hub / github.com/webpack/webpack / devtoolBackCompat

Function devtoolBackCompat

lib/config/normalization.js:627–643  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

625 let cached;
626
627 const devtoolBackCompat = () => {
628 if (Array.isArray(_devtool)) {
629 if (cached) return cached;
630 // Prefer `all`, then `javascript`, then `css`
631 const match = ["all", "javascript", "css"]
632 .map((type) =>
633 /** @type {Extract<WebpackOptionsNormalized["devtool"], EXPECTED_ANY[]>} */ (
634 _devtool
635 ).find((item) => item.type === type)
636 )
637 .find(Boolean);
638
639 // If `devtool: []` is specified, return `false` here
640 return (cached = match ? match.use : false);
641 }
642 return _devtool;
643 };
644
645 /** @type {ProxyHandler<WebpackOptionsNormalized>} */
646 const handler = Object.create(null);

Callers 1

Calls 1

isArrayMethod · 0.80

Tested by

no test coverage detected