Build plugin for Kibana 6.4.0

Hello team, can't make my plugin works at all.

My plugin has some typescript files, also it has some imports from Kibana itself. When I use Kibana downloaded from the GitHub branch, my plugin works using --dev and without it.

My problem comes from building my zip package to use it using kibana-plugin install file:///my.zip and the error es fully related to TS files.

Here is my package.json:

{
    "name": "wazuh",
    "version": "3.5.0",
    "revision": "0403",
    "kibana": {
        "version": "6.4.0"
    },
    "description": "Wazuh app",
    "main": "index.js",
    "keywords": [
        "kibana",
        "wazuh",
        "ossec"
    ],
    "author": "Wazuh, Inc",
    "license": "GPL-2.0",
    "repository": {
        "type": "git",
        "url": "https://github.com/wazuh/wazuh-kibana-app.git"
    },
    "bugs": {
        "url": "https://github.com/wazuh/wazuh-kibana-app/issues"
    },
    "homepage": "https://www.wazuh.com/",
    "dependencies": {
        "angular-animate": "1.6.5",
        "angular-cookies": "1.6.5",
        "angular-material": "1.1.10",
        "dom-to-image": "^2.6.0",
        "install": "^0.10.1",
        "js2xmlparser": "^3.0.0",
        "json2csv": "^4.1.2",
        "needle": "^2.0.1",
        "node-cron": "^1.1.2",
        "pdfmake": "^0.1.37",
        "querystring-browser": "1.0.4",
        "simple-tail": "^1.1.0",
        "timsort": "^0.3.0",
        "winston": "3.0.0"
    },
    "devDependencies": {
        "eslint": "^5.4.0",
        "kbn-plugin-helpers": "link:../../kibana/packages/kbn-plugin-helpers",
        "typescript-eslint-parser": "^18.0.0"
    }
}

Usually our build process is:

cd myplugin
npm install
cd ..
zip -r myplugin.zip myplugin
kibana-plugin install file:///myplugin.zip

When developing I use yarn add --dev link:../../kibana/packages/kbn-plugin-helpers and yarn kbn bootstrap and it works like a charm. I can run my plugin with yarn start and with ./bin/kibana (prod)

My main question, how to build my plugin zip file now?

Thanks in advance,
Regards

Hello,

Can you post exactly what error you are getting?

It seems like my ts files are not being compiled, so the kibana-plugin install procedure fails.

It seems like my tsconfig.json is not being applied when optimizing.

    ERROR in ./plugins/wazuh/public/kibana-integrations/kibana-visualization.js
    Module not found: Error: Can't resolve './loader' in '/usr/share/kibana/plugins/wazuh/public/kibana-integrations'
    
    ERROR in ./plugins/wazuh/public/directives/index.js
    Module not found: Error: Can't resolve './wz-welcome-card/wz-welcome-card' in '/usr/share/kibana/plugins/wazuh/public/directives'

Loader is a module written using TypeScript, same for wz-welcome-card. The problem is very clear from my view. My tsconfig.json is being ignored, my .ts files are not being transpiled when using kibana-plugin install.

If I use Kibana from GitHub tag v6.4.0 I can run my plugin using --dev or not using it.

Also my .kibana-plugin-helpers.json is as follow:

{
  "buildSourcePatterns": [
    "package.json",
    "tsconfig.json",
    "config.yml",
    "index.js",
  	"init.js",
    "server/**/*",
    "public/**/*",
    "util/**/*"
  ]
}

Ok finally I got it working. I've compiled my ts files before using the tsconfig.json extended from Kibana, then I deleted the .ts files and that's all!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.