I've been working on creating a custom plugin in Kibana 7.8. I've got it working but I'm having problems doing a yarn build
so I can install the plugin on our dev server. Following the steps lined out here: https://github.com/elastic/kibana/issues/70426, I was able to get my plugin to install and run on the dev server. However, if I install other node packages in my plugin, I get es2015 errors for the installed package. For example, if I install the uuid
node package as a dependency for my plugin and then run the node scripts/build_kibana_platform_plugins
I get the following error:
ERROR in ./node_modules/uuid/dist/parse.js
│ Module parse failed: disallowed syntax found in file /kibana/plugins/custom_filter_bar/node_modules/uuid/dist/parse.js:
│ - [es2015] let/const variable declaration
│ You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
│ Error: disallowed syntax found in file /kibana/plugins/custom_filter_bar/node_modules/uuid/dist/parse.js:
│ - [es2015] let/const variable declaration
│ at parser.hooks.program.tap.program (/kibana/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/disallowed_syntax_plugin.ts:64:17)
│ at SyncBailHook.eval (eval at create (/kibana/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
│ at Parser.parse (/kibana/node_modules/webpack/lib/Parser.js:2280:26)
│ at doBuild.err (/kibana/node_modules/webpack/lib/NormalModule.js:482:32)
│ at runLoaders (/kibana/node_modules/webpack/lib/NormalModule.js:358:12)
│ at /kibana/node_modules/loader-runner/lib/LoaderRunner.js:373:3
│ at iterateNormalLoaders (/kibana/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
│ at Array.<anonymous> (/kibana/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
│ at Storage.finished (/kibana/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
│ at provider (/kibana/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
│ at /kibana/node_modules/graceful-fs/graceful-fs.js:115:16
│ at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
│ @ ./node_modules/uuid/dist/index.js 77:36-57
│ @ ./public/components/editor.js
│ @ ./public/custom_filter_bar_vis_type.tsx
│ @ ./public/plugin.ts
│ @ ./public/index.ts
I found this forum post (New Platform Plugin - disallowed syntax found) about a similar issue and it states I may need to add more to the build
parameter of my package.json
file but I've not gotten anything to work. Does anyone have any suggestions to get third party node modules working in a Kibana 7.8 plugin?
Here's my current package.json
file:
{
"name": "custom_filter_bar",
"version": "1.0.0",
"description": "Allows user to create custom filters displayed in a filter bar",
"kibana": {
"version": "7.8.0"
},
"scripts": {
"kbn": "node ../../../../scripts/kbn.js",
"build": "plugin-helpers build"
},
"devDependencies": {
"@kbn/plugin-helpers": "link:../../packages/kbn-plugin-helpers"
},
"dependencies": {
"lodash": "^4.17.20",
"uuid": "^8.3.2"
}
}