# loader-runner

> Runs (webpack) loaders

Latest version **4.3.2** (published 2026-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install loader-runner
pnpm add loader-runner
yarn add loader-runner
bun add loader-runner
```

## Health

**Score 53/100 (C)** — status: active.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 4.3.2 |
| Published | 2026-04-24 |
| First published | 2016-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/loader-runner) |
| Module format | CommonJS |
| Node | >=6.11.5 |
| Dependencies | 0 |
| Unpacked size | 20.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 307 |
| Author | Tobias Koppers @sokra |
| Maintainers | 15000621931, ev1stensberg, __hai, sokra, avivkeller, evilebottnawi, jhnns |
| Keywords | webpack, loader |

## Links

- npm: https://www.npmjs.com/package/loader-runner
- Repository: https://github.com/webpack/loader-runner
- Homepage: https://github.com/webpack/loader-runner#readme
- Issues: https://github.com/webpack/loader-runner/issues
- Funding: https://opencollective.com/webpack
- npm.io page: https://npm.io/package/loader-runner

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 4.3.2 (latest) — 2026-04-24
- 2.4.0 (old) — 2019-01-15
- 4.3.1 — 2025-10-08
- 4.3.0 — 2022-04-12
- 4.2.0 — 2021-01-07
- 4.1.0 — 2020-09-30
- 4.0.0 — 2020-07-03
- 3.1.0 — 2019-11-25
- 3.0.0 — 2019-01-15
- 2.3.1 — 2018-09-21
- 2.3.0 — 2017-01-26
- 2.2.0 — 2016-09-14
- 2.1.1 — 2016-02-03
- 2.1.0 — 2016-01-21
- 2.0.1 — 2016-01-03
- … 1 more at https://npm.io/package/loader-runner/versions

## README

# loader-runner

```js
import { runLoaders } from "loader-runner";

runLoaders(
	{
		resource: "/abs/path/to/file.txt?query",
		// String: Absolute path to the resource (optionally including query string)

		loaders: ["/abs/path/to/loader.js?query"],
		// String[]: Absolute paths to the loaders (optionally including query string)
		// {loader, options}[]: Absolute paths to the loaders with options object

		context: { minimize: true },
		// Additional loader context which is used as base context

		processResource: (loaderContext, resourcePath, callback) => {
			// ...
		},
		// Optional: A function to process the resource
		// Must have signature function(context, path, function(err, buffer))
		// By default readResource is used and the resource is added a fileDependency

		readResource: fs.readFile.bind(fs),
		// Optional: A function to read the resource
		// Only used when 'processResource' is not provided
		// Must have signature function(path, function(err, buffer))
		// By default fs.readFile is used
	},
	(err, result) => {
		// err: Error?
		// result.result: [Buffer | String, SourceMap?, Meta?]
		// The result as an array matching the arguments passed by the final normal loader
		// (typically [content, sourceMap, meta])
		// only available when no error occurred
		// result.resourceBuffer: Buffer
		// The raw resource as Buffer (useful for SourceMaps)
		// only available when no error occurred
		// result.cacheable: Bool
		// Is the result cacheable or do it require reexecution?
		// result.fileDependencies: String[]
		// An array of paths (existing files) on which the result depends on
		// result.missingDependencies: String[]
		// An array of paths (not existing files) on which the result depends on
		// result.contextDependencies: String[]
		// An array of paths (directories) on which the result depends on
	}
);
```

More documentation following...

---
_Source: https://npm.io/package/loader-runner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
