I would like to validate an XML file based upon its schema in an electron application.
I have an angular2 service which works before the inclusion of my libxml-xsd require statement. As soon as I add this to the top of my service file:
const xsd = require('libxml-xsd');
I run npm run build which executes this :
webpack --progress --profile --colors --display-error-details --display-cached
I see the following new warnings in the output:
WARNING in ./~/bindings/bindings.js
Critical dependencies:
76:22-40 the request of a dependency is an expression
76:43-53 the request of a dependency is an expression
@ ./~/bindings/bindings.js 76:22-40 76:43-53
WARNING in ./~/bindings/README.md
Module parse failed: /Users/myusername/Documents/Personal/MyApp/node_modules/bindings/README.md Unexpected token (2:3)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:3)
at Parser.pp$4.raise (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp$3.parseExprAtom (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:1822:12)
at Parser.pp$3.parseExprSubscripts (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:1715:21)
at Parser.pp$3.parseMaybeUnary (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:1692:19)
at Parser.pp$3.parseExprOp (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:1656:43)
at Parser.pp$3.parseExprOp (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:1658:21)
at Parser.pp$3.parseExprOps (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:1639:17)
at Parser.pp$3.parseMaybeConditional (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:1620:21)
at Parser.pp$3.parseMaybeAssign (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:1597:21)
at Parser.pp$3.parseExpression (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:1573:21)
at Parser.pp$1.parseStatement (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:727:47)
at Parser.pp$1.parseTopLevel (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/Users/myusername/Documents/Personal/MyApp/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/Users/myusername/Documents/Personal/MyApp/node_modules/webpack/lib/Parser.js:902:15)
at DependenciesBlock.<anonymous> (/Users/myusername/Documents/Personal/MyApp/node_modules/webpack/lib/NormalModule.js:104:16)
at DependenciesBlock.onModuleBuild (/Users/myusername/Documents/Personal/MyApp/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/Users/myusername/Documents/Personal/MyApp/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /Users/myusername/Documents/Personal/MyApp/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.finished (/Users/myusername/Documents/Personal/MyApp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
at /Users/myusername/Documents/Personal/MyApp/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:446:3)
@ ./~/bindings ^\.\/.*$
I then run my application by executing : electron main.js which then throws this error in the browsers console:
Uncaught Error: Could not locate the bindings file. Tried:
→ /Users/myusername/Documents/Personal/MyApp/build/xmljs.node
→ /Users/myusername/Documents/Personal/MyApp/build/Debug/xmljs.node
→ /Users/myusername/Documents/Personal/MyApp/build/Release/xmljs.node
→ /Users/myusername/Documents/Personal/MyApp/out/Debug/xmljs.node
→ /Users/myusername/Documents/Personal/MyApp/Debug/xmljs.node
→ /Users/myusername/Documents/Personal/MyApp/out/Release/xmljs.node
→ /Users/myusername/Documents/Personal/MyApp/Release/xmljs.node
→ /Users/myusername/Documents/Personal/MyApp/build/default/xmljs.node
→ /Users/myusername/Documents/Personal/MyApp/compiled/6.5.0/darwin/x64/xmljs.node
Could somebody please help me get libxml-xsd running under my application configuration? Does this have anything to do with webpack? If so - how do I change its config to bring in the appropriate files?