Skip to content

jeanphilippeds/js-yaml-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-yaml-loader for Webpack

JS-YAML loader for webpack.

Installation

yarn add js-yaml-loader

Usage

Webpack documentation

import doc from 'js-yaml-loader!./file.yml';
// => returns a javascript object. see https://github.com/nodeca/js-yaml
// webpack.config.js
module: {
  rules: [{
    test: /\.yaml$/,
    use: 'js-yaml-loader',
  }]
}

Loader options

safe (boolean) (default=true)

Use safeLoad instead of load. Set safe to false to allow unsafe types to load, such as regular expressions, functions, and undefined.

Difference from yaml-loader

yaml-loader loads YAML files as JSON and is commonly used in conjuction with json-loader.

In contrast, this loader loads YAML files as JavaScript objects using the un-eval library. This allows YAML value types otherwise disallowed in JSON such as Infinity, RegExp, Function, etc. See js-yaml's supported YAML types

License

MIT

About

JS-YAML loader for webpack

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.5%
  • Shell 5.5%