Hi everyone,
I have succeeded in sharing components (client-code) between plugins (at How to share components among Kibana plugins?).
I assumed that there must the similar way to share server code, but no luck.
I exported things of 'plugin_commons' from server/index.ts. Then from other plugins, I use import * as commons from 'plugins/plugin_commons'
It won't work and will throw error FATAL Error: Cannot find module 'plugins/plugin_commons'
I looked back at the original post. Thanks for including that, it had a lot of good context.
I think import {DateRangePicker} from 'plugins/plugins_commons'; only works in UI code because it uses a trick provided by the way Kibana bundles the UI code for the browser. In server code, import only works for the actual filesystem reference.
import {DateRangePicker} from '../../path/to/root/of/plugins/common/server';
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.