Package Exports
- @jackwilsdon/craco-json-schema-dereferencer
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jackwilsdon/craco-json-schema-dereferencer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
craco-json-schema-dereferencer
A craco plugin that adds JSON Schema dereferencing to create-react-app 2.
Powered by @cloudflare/json-schema-ref-loader
Installation
Make sure you have craco installed before continuing. You can find the official installation instructions here.
You can then install craco-json-schema-dereferencer using your package manager
of choice;
npm install --save @jackwilsdon/craco-json-schema-dereferenceryarn add @jackwilsdon/craco-json-schema-dereferencerUsage
The plugin provides a few options to allow the inclusion and exclusion of files;
{
// The expression to match to include files.
// Default: /\.json$/ (i.e. files ending with .json)
test: ...,
// The condition to match to include files.
// Default: the app's source directory
include: ...,
}See the webpack condition documentation for possible test
and include values.
These options can be passed under the options property of the plugin;
// craco.config.js
const DereferencerPlugin = require('@jackwilsdon/craco-json-schema-dereferencer');
const path = require('path');
module.exports = {
plugins: [
{
plugin: DereferencerPlugin,
options: {
// Only dereference .schema.json files.
test: /\.schema\.json/,
// Only dereference files in the schemas directory.
include: path.join(__dirname, 'src', 'schemas'),
},
},
],
};