We have a plugin that we have built that we are now needing to add additional dependencies to. yarn add react-paginate@^8.2.0 react-tooltip@^5.26.2 yarn kbn bootstrap respects that these dependencies exist and will include them in the node_modules. Which gets us through development.
When we move towards yarn build --skip-os-packages --release to build the kibana-8.8.0-linux-x86_64.tar.gz that process omits the new dependencies
we see this in the output that is impacting our node_modules which are not included in the kibana-8.8.0-linux-x86_64.tar.gz.
info [ kibana ] Creating build-ready version of package.json
[911](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L911) │ succ ✓ 17 sec
[912](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L912) info [ kibana ] Installing node_modules, including production builds of packages
[913](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L913) │ debg $ /root/.nvm/versions/node/v16.19.1/lib/node_modules/yarn/bin/yarn.js install --non-interactive --production --ignore-optional --pure-lockfile --prefer-offline --no-bin-links
[914](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L914) │ debg [1/5] Validating package.json...
[915](https://gitlab.com/koat/KOAT-Kibana/-/jobs/6185500620#L915) │ debg [2/5] Resolving packages...
How are others adding new dependencies that your plugins need to the Kibana deployment?
Further into my investigation I found that the yarn build does look at a Kibana\packages\kbn-find-used-node-modules which does a rebuild of the package.json based on the peer modules used in Kibana's base package which is why the node_modules are not present when building the kibana-8.8.0-linux-x86_64.tar.gz . this leads us to believe that the plugin itself with the node.lock and package.json can install additional node_modules when a plugin is installed into the Base install of Kibana. We are investigating this next path and hope this is the case because we do see that a plugin install does hit the setup_node_env.
We are still having issues with getting the additional node_modules installed during the plugin install if there is anyone that can provide some guidance on how to add node_modules that we wish to use in our plugins.
Are you adding these new dependencies in the root level package.json by any chance?
I believe they should be added in plugins/<plugin name>/package.json instead.
So when the build of Kibana is being made, any plugins that have added npm packages in them have to be in the plugins folder for those packages to be included?
Hey @gsoldevila we see the node_modules do end up in the <plugin name>/node_modules is there a way to reference the node_modules that the plugins need from that folder rather then the kibana/node_modules folder?
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.