Download next.js/packages/next/src/build/webpack/loaders/error-loader.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 730 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/build/webpack/loaders/error-loader.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/build/webpack/loaders/error-loader.ts
-
curl -L -o error-loader.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/build/webpack/loaders/error-loader.ts
730 Bytes
| import { cyan } from '../../../lib/picocolors' | |
| import path from 'path' | |
| import type { webpack } from 'next/dist/compiled/webpack/webpack' | |
| const ErrorLoader: webpack.LoaderDefinitionFunction = function () { | |
| // @ts-ignore exists | |
| const options = this.getOptions() || ({} as any) | |
| const { reason = 'An unknown error has occurred' } = options | |
| // @ts-expect-error | |
| const resource = this._module?.issuer?.resource ?? null | |
| const context = this.rootContext ?? this._compiler?.context | |
| const issuer = resource | |
| ? context | |
| ? path.relative(context, resource) | |
| : resource | |
| : null | |
| const err = new Error(reason + (issuer ? `\nLocation: ${cyan(issuer)}` : '')) | |
| this.emitError(err) | |
| } | |
| export default ErrorLoader | |