# js-yaml-loader

> YAML loader for webpack

Latest version **1.2.2** (published 2019-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install js-yaml-loader
pnpm add js-yaml-loader
yarn add js-yaml-loader
bun add js-yaml-loader
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2019-06-28 |
| First published | 2017-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 39 |
| Author | Wil Wilsman |
| Maintainers | wwilsman |
| Keywords | yaml, webpack, loader |

## Links

- npm: https://www.npmjs.com/package/js-yaml-loader
- Repository: https://github.com/wwilsman/js-yaml-loader
- Homepage: https://github.com/wwilsman/js-yaml-loader#readme
- Issues: https://github.com/wwilsman/js-yaml-loader/issues
- npm.io page: https://npm.io/package/js-yaml-loader

## Dependencies (3)

- [js-yaml](https://npm.io/package/js-yaml.md) ^3.13.1
- [un-eval](https://npm.io/package/un-eval.md) ^1.2.0
- [loader-utils](https://npm.io/package/loader-utils.md) ^1.2.3

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 1.2.2 (latest) — 2019-06-28
- 1.2.1 — 2019-06-21
- 1.2.0 — 2019-05-23
- 1.1.0 — 2019-05-20
- 1.0.1 — 2018-10-16
- 1.0.0 — 2018-09-19
- 0.1.0 — 2017-08-18

## README

# js-yaml-loader for Webpack

[JS-YAML](https://github.com/nodeca/js-yaml) loader for webpack.

## Installation

`yarn add js-yaml-loader`

## Usage

[Webpack documentation on using loaders.](https://webpack.js.org/concepts/loaders/#using-loaders)

Using the loader inline:

``` javascript
import doc from 'js-yaml-loader!./file.yml';
// => returns a javascript object. see https://github.com/nodeca/js-yaml
```

Or using the loader via Webpack configuration (recommended):

``` javascript
// webpack.config.js
module: {
  rules: [{
    test: /\.yaml$/,
    use: 'js-yaml-loader',
  }]
}
```

## Loader options

### safe *(boolean) (default=true)*

Use [`safeLoad`](https://github.com/nodeca/js-yaml#safeload-string---options-)
instead of [`load`](https://github.com/nodeca/js-yaml#load-string---options-).
Set `safe` to `false` to allow unsafe types to load, such as regular
expressions, functions, and `undefined`.

### iterator *(function) (default=undefined)*

The [`iterator`](https://github.com/nodeca/js-yaml#safeloadall-string--iterator--options-)
option passed to `safeLoadAll` and `loadAll`. Applies `iterator` to each
document if specified.

### ...options

Any other options are passed directly to to `safeLoad` or `load` as the
[`options`](https://github.com/nodeca/js-yaml#safeload-string---options-)
parameter.

## Difference from [yaml-loader](https://github.com/okonet/yaml-loader)

[yaml-loader](https://github.com/okonet/yaml-loader) loads YAML files
as _JSON_ and is commonly used in conjuction with [json-loader](https://github.com/webpack-contrib/json-loader).

In contrast, this loader loads YAML files as JavaScript objects using the
[un-eval](https://github.com/tiansh/un_eval.js) library. This allows YAML value
types otherwise disallowed in JSON such as `Infinity`, `RegExp`, `Function`,
etc. [See js-yaml's supported YAML types](https://github.com/nodeca/js-yaml#supported-yaml-types)

## License

[MIT](http://www.opensource.org/licenses/mit-license.php)

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