YAML loader for Webpack. Allows importing YAML files as JS objects. Uses yaml
internally.
npm install --save-dev @chronotruck/yaml-loader
// webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.ya?ml$/,
use: '@chronotruck/yaml-loader'
}
]
}
}
# file.yaml
---
config:
js:
key: test
hello: world
// application.js
import file from './file.yaml'
file.hello === 'world'
Forked from https://github.com/eemeli/yaml-loader and simplified for our own specific case.