MaikoTan / yml-register

Hooks into Node's require function to load `.yaml` and `.yml` files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yml-register

downloads npm GitHub

Hooks into Node's require function to load .yaml and .yml files.

Usage

From CLI

node -r yml-register path/to/index.js

Manually import

require('yml-register')
require('/path/to/my-file.yaml') // now it works!

TypeScript support

In order to fixing the error Cannot find module 'file.yaml' or its corresponding type declarations. when using import statement in TypeScript, we provides a type declaration bundled in this package.

What you need is to append compilerOptions.types by yml-register/types in tsconfig.json.

{
  "compilerOptions": {
    "types": [
      "yml-register/types"
    ]
  }
}

About

Hooks into Node's require function to load `.yaml` and `.yml` files

License:MIT License


Languages

Language:TypeScript 100.0%