When trying to use schemarama from npm for code that will be running in browser the following errors appear:
ERROR in /home/elizusha/schemarama/core/util.js
Module not found: Error: Can't resolve 'fs' in '/home/elizusha/schemarama/core'
@ /home/elizusha/schemarama/core/util.js 17:11-24
@ /home/elizusha/schemarama/core/index.js
@ ./src/index.js
ERROR in /home/elizusha/schemarama/core/third_party/shex/shex.js
Module not found: Error: Can't resolve 'fs' in '/home/elizusha/schemarama/core/third_party/shex'
@ /home/elizusha/schemarama/core/third_party/shex/shex.js 7664:17-30
@ /home/elizusha/schemarama/core/shexValidator.js
@ /home/elizusha/schemarama/core/index.js
@ ./src/index.js
I think that the problem is that fs module is only available for node.js. In browsers you cannot have access to the file system anyway. This PR removes hard dependency on fs module: if it's available it will be used, if it's not available it will not throw an error unless you try to load a local file.
When trying to use schemarama from npm for code that will be running in browser the following errors appear:
I think that the problem is that fs module is only available for node.js. In browsers you cannot have access to the file system anyway. This PR removes hard dependency on fs module: if it's available it will be used, if it's not available it will not throw an error unless you try to load a local file.