Webpack loader that resolves Json Schema references.

Usage no npm install needed!

<script type="module">
  import addapsJsonSchemaLoader from 'https://cdn.skypack.dev/@addaps/json-schema-loader';


Json Schema Loader

This package is part of the doca suite. Please file any issues at the doca repository


npm install json-schema-loader --save


Webpack loader that resolves both internal and external json schema references ($ref properties). The loader uses json-schema-ref-parser to resolve references. It supports both JSON and YAML. Based on @pr0da/json-schema-loader.


var resolvedSchema = require('json-schema-loader!./schema.json');

Or define it in your webpack.config.js

module: {
  loaders: [{
    test: /\.json$/,
    exclude: /node_modules/,
    loader: 'json-schema-loader'
var resolvedSchema = require('./schema.json');


useSource: boolean

This loader normally passes the RefParser the resourcePath, not the source. If you want to chain loaders, make sure to set useSource=true.