jsonpath
jsonpath copied to clipboard
Support pkg (executable nodejs app)
https://www.npmjs.com/package/pkg can't handle pathed aesprim
module with error
Error: Cannot find module 'esprima'
At the moment I don't use @
literal in json paths so the dirty hack to make it work would be replacing https://github.com/dchester/jsonpath/blob/master/lib/aesprim.js with
module.exports = require('esprima')
Any better ideas?
I have almost same error.
I require library json-schema-faker
which uses jsonpath
i have error Error: Cannot find module 'esprima'
when i try to bundle with pkg
.
Exact same issue. Any work-arounds?
Thanks for posting the issue
I found a pretty good workaround for my use case. Instead of require("jsonpath")
use require("jsonpath/jsonpath.min")
. The latter is basically the browserified version, and that one doesn't use the monkey-patching trickery that breaks the Pkg build. Hope that's useful!
@edvald - thanks so much - this is great. Really appreciate you posting a solution.
This isn't much of a solution, if jsonpath is a sub-dependency it still breaks things. Does anyone have any other workarounds?
Is there any workaround for cases where it's a subdependency?
to anyone else hitting this, switching to jsonpath-plus
is a viable workaroud/solution to this because it doesn't have this problem.