v1.9.0 @cfworker/json-schema/dist/validator.js - Error when importing
See original GitHub issueThe following code in validator.js:
export class Validator {
schema;
draft;
shortCircuit;
lookup;
constructor(schema, draft = '2019-09', shortCircuit = true) {
this.schema = schema;
this.draft = draft;
this.shortCircuit = shortCircuit;
this.lookup = dereference(schema);
// rest of code
}
causes a loader error when attempting to import { Validator } from '@cfworker/json-schema'
. It appears JS does not understand schema, draft, shortCircuit, lookup
public instance fields appearing before constructor. Issue is fixed after removing.
Working validator.js code:
export class Validator {
constructor(schema, draft = '2019-09', shortCircuit = true) {
this.schema = schema;
this.draft = draft;
this.shortCircuit = shortCircuit;
this.lookup = dereference(schema);
// rest of code
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Error [ERR_MODULE_NOT_FOUND]: Cannot find module
This just worked for me, referencing my TS-extensioned exporting files as JS, where imported. The more I learn about JavaScript/TypeScript/Node, ...
Read more >Get syntax error when importing into a React app #690 - GitHub
Description tl;dr: Here's a recording of the issue - https://recordit.co/hzEhqOLC1X I am using Next, React and Model Viewer to try and make ...
Read more >import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >Resolve "Unable to import module" errors from Python ... - AWS
I receive an "Unable to import module" error when I try to run my AWS Lambda code in Python. How do I resolve...
Read more >GUS Import Issues (Technical Bulletin) - GovDelivery
regarding the import error messages. A very common message received is: “MISMO XML Contents do not pass the MISMO & Extension Schema Validation”...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jdanyow Updated to 1.10.1, and it works like a charm. Thank you!
The error appeared while attempting to publish a Worker via Wrangler from a local machine. I had installed @cfworker/json-schema locally via npm (v6.14.14)
edit: Also would like to say thanks to everyone who contributed to these packages. I was struggling with Ajv for a bit until I found this.