# extract-file-loader

> Loader and plugin for webpack to add proxied asset as a chunk file

Latest version **0.1.1** (published 2019-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install extract-file-loader
pnpm add extract-file-loader
yarn add extract-file-loader
bun add extract-file-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-01-08 |
| First published | 2016-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 1 |
| Unpacked size | 20.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Marius Balčytis |
| Maintainers | mariusbalcytis |

## Links

- npm: https://www.npmjs.com/package/extract-file-loader
- Repository: https://github.com/mariusbalcytis/extract-file-loader
- Issues: https://github.com/mariusbalcytis/extract-file-loader/issues
- npm.io page: https://npm.io/package/extract-file-loader

## Dependencies (1)

- [loader-utils](https://npm.io/package/loader-utils.md) ~0.2.5

## Recent versions

- 0.1.1 (latest) — 2019-01-08
- 0.2.1 — 2019-01-08
- 0.3.1 — 2019-01-08
- 0.3.0 — 2018-12-10
- 0.2.0 — 2017-08-22
- 0.1.0 — 2016-09-13

## README

# Extract file loader for webpack

Reason for this module:

- [assets-webpack-plugin](https://github.com/kossnocorp/assets-webpack-plugin)
generates a manifest of emitted files for each chunk
- [file-loader](https://github.com/webpack/file-loader) emits files, but they are
not added to the chunk files
- this loader is used as a proxy to include this emitted file in the chunk
so it's available in generated manifest

## Usage

```js
require('extract-file?q=file%3Fname=[name].[hash].[ext]%21image.png!');
//                       %3F = ?                    %21 = !
```

### Why did you put asset in the query string?!

Asset to require internally is provided via `q` query string parameter.

This is to avoid collisions with rules in your configuration file, where you configure
loaders by their extensions.

Keep in mind that you have to fully URL-encode the asset as webpack will not parse
it correctly if you don't (there cannot be any literal `!` inside the query)


## Example configuration

See [example configuration](test/webpack.config.js) in `test` directory.

Test is functional - it checks if that configuration produces manifest
with correct `png` file entry.

## Use cases

Use this for requiring binary files (like images) as entry points.

This module is to be used with some pre/post-processing, as by default
this loader still produces javascript file - path to asset is only added
in the manifest.

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