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 * as obj from 'esm-yaml-loader!./file.yml'
import obj from 'esm-yaml-loader!./file.yml'
This loader is also useful for getting a valid JSON from YML. For example:
module: {
loaders: [
{
test: /\.ya?ml$/,
loader: 'esm-yaml-loader',
},
],
}
and then
import(`./../data/${file}.yaml`).then(res => {
})
License
MIT (http://www.opensource.org/licenses/mit-license.php)