esm-yaml-loader

0.5.0 • Public • Published

esm-yaml-loader for webpack

ES Module YAML loader for webpack. Converts YAML to an ES Module. This is a fork of yaml-loader.

Installation

npm install esm-yaml-loader

Usage

Documentation: Using loaders

Simplest case would be:

// Import tree shakeable identifiers from yaml
import * as obj from 'esm-yaml-loader!./file.yml'
// or the default export for variable identifiers that aren't valid ES6
import obj from 'esm-yaml-loader!./file.yml'

This loader is also useful for getting a valid JSON from YML. For example:

// webpack.config.js
module: {
  loaders: [
    {
      test: /\.ya?ml$/,
      loader: 'esm-yaml-loader',
    },
  ],
}

and then

// application.js
import(`./../data/${file}.yaml`).then(res => {
  // ...
})

License

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

Package Sidebar

Install

npm i esm-yaml-loader

Weekly Downloads

0

Version

0.5.0

License

MIT

Unpacked Size

86.9 kB

Total Files

9

Last publish

Collaborators

  • wegry