I am trying to read a file from within a custom visualization in Kibana 6.2.2. I am calling fs.readFileSync but am getting the following error from Kibana at runtime.
Uncaught TypeError: fs.readFileSync is not a function
It looks as if Kibana cannot find the fs library. I thought that fs was standard in node.js and that it would be available once declared via:
import fs from 'fs';
or
var fs = require('fs');
I have tried installing both fs and fs2 explicity via yarn and npm but with no success. I notice other inbuilt Kibana plugins call fs.fileReadSync with the same syntax which makes me think it may not be a node version issue.
Is there something I am missing with dependencies or libraries when writing visualisations? The 'Managing Dependencies' page in the documentation seems very clear and easy to follow but this one really has me stumped.
Any ideas or guidance from those that may have gone down this path before would be very much appreciated!