yml-loader

raw JSON →
2.1.0 verified Sat Apr 25 auth: no javascript maintenance

YAML loader for webpack that imports .yml files as JSON objects. Version 2.1.0 is the latest stable release. This loader supports multiple documents via the `multiDocument` option and key blacklisting via `keysToRemove` to exclude sensitive keys from output. It is commonly used in webpack configurations to load YAML configuration files. The package is unmaintained since 2019 and relies on `js-yaml` for parsing. Alternatives like `yaml-loader` offer more active maintenance and broader compatibility with webpack 4+.

error Module not found: Error: Can't resolve 'yml-loader'
cause Loader not installed or not in node_modules.
fix
Install with npm install --save-dev yml-loader.
error Module build failed: Error: Cannot find module 'js-yaml'
cause Missing peer dependency `js-yaml`.
fix
Install js-yaml with npm install --save-dev js-yaml.
breaking Webpack 1 loader syntax is incompatible with webpack 2+. Use `rules` and `use` instead of `loaders` and `loader`.
fix Use `module.rules` array with `use` property for webpack 2+.
deprecated Package is unmaintained since 2019; no updates for webpack 5 compatibility.
fix Consider migrating to `yaml-loader` (npm: yaml-loader) which is actively maintained.
npm install yml-loader
yarn add yml-loader
pnpm add yml-loader

Shows how to configure webpack to load YAML files using yml-loader with key removal option.

// In webpack config
module.exports = {
  module: {
    rules: [
      {
        test: /\.ya?ml$/,
        use: [
          {
            loader: 'yml-loader',
            options: {
              keysToRemove: ['private_key']
            }
          }
        ]
      }
    ]
  }
};

// Then in your code
import config from './config.yml';
console.log(config); // outputs parsed YAML as JS object