# Custom plugin with typescript support works fine in development environment but build fails with yarn build

**URL:** <https://discuss.elastic.co/t/custom-plugin-with-typescript-support-works-fine-in-development-environment-but-build-fails-with-yarn-build/205168>\
**Category:** Kibana\
**Created:** [October 25, 2019, 2:25am UTC](https://discuss.elastic.co/t/custom-plugin-with-typescript-support-works-fine-in-development-environment-but-build-fails-with-yarn-build/205168 "2019-10-25T02:25:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devesh37](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/devesh37/32/56685_2.png) [@devesh37](https://discuss.elastic.co/u/devesh37)\
**Post date:** [October 25, 2019, 2:25am UTC](https://discuss.elastic.co/t/custom-plugin-with-typescript-support-works-fine-in-development-environment-but-build-fails-with-yarn-build/205168/1 "2019-10-25T02:25:14Z")

</div>

Hi,

I am new to kibana custom plugin building.

i want to developed kibana custom plugin with typescript enabled.  
i have setup kiaban development enviroment correctly. My plugin is working fine in development enviroment but when i build it throws lots of error realted to nide\_modules and typescript

my package,json file is this.

> {  
> "name": "orbat",  
> "version": "0.0.0",  
> "description": "orbat",  
> "main": "index.js",  
> "kibana": {  
> "version": "6.8.0",  
> "templateVersion": "1.0.0"  
> },  
> "scripts": {  
> "preinstall": "node ../../kibana/preinstall\_check",  
> "kbn": "node ../../kibana/scripts/kbn",  
> "es": "node ../../kibana/scripts/es",  
> "lint": "eslint .",  
> "start": "plugin-helpers start",  
> "test:server": "plugin-helpers test:server",  
> "test:browser": "plugin-helpers test:browser",  
> "build": "plugin-helpers build"  
> },  
> "dependencies": {  
> "@elastic/eui": "^14.4.0",  
> "@types/enzyme": "^3.10.3",  
> "@types/react-virtualized": "^9.21.5",  
> "body-scroll-lock": "^2.5.10",  
> "classnames": "^2.2.6",  
> "d3": "^5.7.0",  
> "debug": "^4.1.0",  
> "isomorphic-fetch": "^2.2.1",  
> "leaflet": "^1.3.4",  
> "lodash": "^4.17.11",  
> "mobx": "^5.5.0",  
> "mobx-react": "^5.2.8",  
> "mobx-utils": "^5.0.2",  
> "moment": "^2.22.2",  
> "next": "^7.0.1",  
> "normalize.css": "^8.0.0",  
> "polished": "^2.2.0",  
> "popmotion": "^8.4.1",  
> "react": "^16.5.2",  
> "react-compound-slider": "^0.16.2",  
> "react-dom": "^16.5.2",  
> "react-leaflet": "^2.0.1",  
> "react-pose": "^3.3.6",  
> "reuse": "^1.0.4",  
> "styled-components": "^3.4.9"  
> },  
> "devDependencies": {  
> "@babel/plugin-proposal-class-properties": "^7.1.0",  
> "@babel/plugin-proposal-decorators": "^7.1.2",  
> "@elastic/eslint-config-kibana": "link:../../kibana/packages/eslint-config-kibana",  
> "@elastic/eslint-import-resolver-kibana": "link:../../kibana/packages/kbn-eslint-import-resolver-kibana",  
> "@kbn/plugin-helpers": "link:../../kibana/packages/kbn-plugin-helpers",  
> "@svgr/webpack": "^3.1.0",  
> "@types/classnames": "^2.2.6",  
> "@types/d3": "^5.0.0",  
> "@types/isomorphic-fetch": "0.0.34",  
> "@types/leaflet": "^1.2.11",  
> "@types/lodash": "^4.14.116",  
> "@types/moment": "^2.13.0",  
> "@types/next": "^7.0.0",  
> "@types/react": "^16.4.14",  
> "@types/react-dom": "^16.0.8",  
> "@types/react-leaflet": "^1.1.6",  
> "@types/styled-components": "^3.0.1",  
> "@zeit/next-css": "^1.0.1",  
> "@zeit/next-typescript": "^1.1.1",  
> "babel-eslint": "^9.0.0",  
> "babel-plugin-styled-components": "^1.8.0",  
> "eslint": "^5.6.0",  
> "eslint-plugin-babel": "^5.2.0",  
> "eslint-plugin-import": "^2.14.0",  
> "eslint-plugin-jest": "^21.26.2",  
> "eslint-plugin-jsx-a11y": "^6.1.2",  
> "eslint-plugin-mocha": "^5.2.0",  
> "eslint-plugin-no-unsanitized": "^3.0.2",  
> "eslint-plugin-prefer-object-spread": "^1.2.1",  
> "eslint-plugin-react": "^7.11.1",  
> "expect.js": "^0.3.1",  
> "mobx-react-devtools": "^6.0.3",  
> "prettier": "^1.14.3",  
> "tslint": "^5.11.0",  
> "tslint-config-prettier": "^1.15.0",  
> "tslint-plugin-prettier": "^2.0.1",  
> "tslint-react": "^3.6.0",  
> "typescript": "^3.1.3"  
> }  
> }

**Error which i am getting during build :-**

> 2945 sub: React.DetailedHTMLProps\<React.HTMLAttributes, HTMLElement\>;  
> ~~~
> 
> ../../../node\_modules/@types/next-server/node\_modules/@types/react/index.d.ts:2924:13  
> 2924 sub: React.DetailedHTMLProps\<React.HTMLAttributes, HTMLElement\>;  
> ~~~  
> 'sub' was also declared here.
> 
> ../../../node\_modules/@types/react/index.d.ts:2946:13 - error TS2717: Subsequent property declarations must have the same type. Property 'summary' must be of type 'DetailedHTMLProps\<HTMLAttributes, HTMLElement\>', but here has type 'DetailedHTMLProps\<HTMLAttributes, HTMLElement\>'.
> 
> 2946 summary: React.DetailedHTMLProps\<React.HTMLAttributes, HTMLElement\>;  
> ~~~~~~~
> 
> ../../../node\_modules/@types/next-server/node\_modules/@types/react/index.d.ts:2925:13  
> 2925 summary: React.DetailedHTMLProps\<React.HTMLAttributes, HTMLElement\>;  
> ~~~~~~~  
> 'summary' was also declared here.

**\> Found 177 errors.**

> ```
> at makeError (D:\gitKBProject\kb680New319\kibana\node_modules\execa\index.js:174:9)
> at Function.module.exports.sync (D:\gitKBProject\kb680New319\kibana\node_modules\execa\index.js:338:15)
> at D:\gitKBProject\kb680New319\kibana\packages\kbn-plugin-helpers\tasks\build\create_build.js:145:13 at process._tickCallback (internal/process/next_tick.js:68:7)
> 
> ```
> 
> error Command failed with exit code 1.  
> info Visit [yarn run | Yarn](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.

**my .tgconfig file is of plugin as follows:-**

> {  
> // extend Kibana's tsconfig, or use your own settings  
> "extends": "../../kibana/tsconfig.json",  
> "compilerOptions": {  
> "baseUrl": ".",  
> "paths": {  
> "ui/_": [  
> "../../kibana/src/ui/public/_"  
> ],  
> },  
> },  
> "include": [  
> "public/**/\*.ts",  
> "public/**/_.tsx",  
> "server/\*\*/_.ts",  
> "server/\*\*/\*.tsx",  
> "index.ts",  
> ],  
> }

I have tried multiple things,  
using kibana 6.8.0 , es 6.8.0

1. yarn kbn bootstrap is going throw fine. = success.

2. plugin working in development environment fine = success.

3. yarn build fails,

4. tried suggestion given in [https://github.com/elastic/kibana/issues/28745](https://github.com/elastic/kibana/issues/28745)

5. suggestion given in "[https://github.com/elastic/kibana/pull/26747](https://github.com/elastic/kibana/pull/26747)" but with no success.

please help , because this is very import to me,

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![devesh37](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/devesh37/32/56685_2.png) [@devesh37](https://discuss.elastic.co/u/devesh37)\
**Post date:** [October 27, 2019, 1:10pm UTC](https://discuss.elastic.co/t/custom-plugin-with-typescript-support-works-fine-in-development-environment-but-build-fails-with-yarn-build/205168/2 "2019-10-27T13:10:04Z")

</div>

there exist a lack of documentation for typescript custom plugins... please pay attention in this domain, because users wants to use typescript and geed community support...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 24, 2019, 1:10pm UTC](https://discuss.elastic.co/t/custom-plugin-with-typescript-support-works-fine-in-development-environment-but-build-fails-with-yarn-build/205168/3 "2019-11-24T13:10:04Z")

</div>

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