ncc
ncc copied to clipboard
It doesn't seem to be working with jsonpath module.
Hey,
The jsonpath module has include/* folder in it and one of my actions where I'm using ncc throws an error that it's unable to find the module.js files in run time.
Any workaround for this?
You could try being explicit like this:
const jsonpath = require('jsonpath')
require("jsonpath/include/module.js")
require("jsonpath/include/action.js")
In my scenario I'm using json-merger which uses jsonpath, so I do not think I'm able to be explicit here. The line that is throwing the error is https://github.com/dchester/jsonpath/blob/master/lib/grammar.js#L102.
node:internal/fs/utils:347
throw err;
^
Error: ENOENT: no such file or directory, open 'D:\projects\some-project\bin/module.js'
Is there any workaround for this?
edit: For my use case it is sufficient to mark the json-merger package as an external:
require('@vercel/ncc')('some-file.ts', {
externals: [
'json-merger'
]
})