typewriter icon indicating copy to clipboard operation
typewriter copied to clipboard

ajv@7+ fails on local development

Open antgonzales opened this issue 3 years ago • 0 comments

After generating a local instance of Typewriter files for analytics.js in Typescript, instructions are provided to include ajv for runtime errors in the ./analytics/index.ts file.

/**
 * Ajv is a peer dependency for development builds. It's used to apply run-time validation
 * to message payloads before passing them on to the underlying analytics instance.
 *
 * Note that the production bundle does not depend on Ajv.
 *
 * You can install it with: `npm install --save-dev ajv`.
 */

When you install the latest version of ajv though, I see the following errors when bundling an application with webpack:

ERROR in ./analytics/index.ts 81:20-69
  Module not found: Error: Can't resolve 'ajv/lib/refs/json-schema-draft-04.json' in ...

Proposal

Either the note needs to include details about which avj@6 as the correct version or ajv needs to be upgraded as a dev dependency.

antgonzales avatar Nov 05 '21 20:11 antgonzales