Sujimoshi / jsonschema-definer

JSON Schema constructor and validator
27 stars 3 forks source link

[Feature] ESM support #34

Open patarapolw opened 3 years ago

patarapolw commented 3 years ago

Currently, a workaround, if you wanted to use 'jsonschema-definer' in *.mjs, is with two files

// commonjs.cjs

module.exports = {
  S: require('jsonschema-definer').default
}
runner.mjs

import cjs from './commonjs.cjs'

/**
 * @type {{
 *  S: import('jsonschema-definer').default
 * }}
 */
const { S } = cjs

Apparently, I don't yet know how to fix this either. Will make a PR once I make a successful experiment.