# New Platform Plugin - disallowed syntax found

**URL:** <https://discuss.elastic.co/t/new-platform-plugin-disallowed-syntax-found/243625>\
**Category:** Kibana\
**Created:** [August 3, 2020, 8:39pm UTC](https://discuss.elastic.co/t/new-platform-plugin-disallowed-syntax-found/243625 "2020-08-03T20:39:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreaTosti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andreatosti/32/75172_2.png) [@AndreaTosti](https://discuss.elastic.co/u/AndreaTosti)\
**Post date:** [August 3, 2020, 8:39pm UTC](https://discuss.elastic.co/t/new-platform-plugin-disallowed-syntax-found/243625/1 "2020-08-03T20:39:05Z")

</div>

Hello everyone, in legacy plugins I was able to run the following import:  
`import EditorJs from 'react-editor-js';`

In the **new platform** (v7.8.2) I can no longer do that import.  
This generates the following errors (when using `node scripts/build_kibana_platform_plugins`), is there a workaround? my plugin is not used by other plugins.

```auto
$ node scripts/build_kibana_platform_plugins
 info initialized, 99 bundles cached
 info starting worker [1 bundles, ? modules]
ERROR webpack compile errors
   │ERROR [myPlugin] build
       │ERROR Optimizations failure.
       │ 186 modules
       │          
       │ ERROR in ./node_modules/@editorjs/editorjs/dist/editor.js
       │ Module parse failed: disallowed syntax found in file /home/tosti/Tosti_/kibana_7.8.2/kibana/plugins/myPlugin/node_modules/@editorjs/editorjs/dist/editor.js:
       │ - [es2015] ...spread
       │ - [es2015] let/const variable declaration
       │ - [es2015] arrow function expression
       │ - [es2015] class
       │ - [es2015] destructuring
       │ 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 /home/tosti/Tosti_/kibana_7.8.2/kibana/plugins/myPlugin/node_modules/@editorjs/editorjs/dist/editor.js:
       │ - [es2015] ...spread
       │ - [es2015] let/const variable declaration
       │ - [es2015] arrow function expression
       │ - [es2015] class
       │ - [es2015] destructuring
       │ at parser.hooks.program.tap.program (/home/tosti/Tosti_/kibana_7.8.2/kibana/packages/kbn-optimizer/src/common/disallowed_syntax_plugin/disallowed_syntax_plugin.ts:64:17)
       │ at SyncBailHook.eval (eval at create (/home/tosti/Tosti_/kibana_7.8.2/kibana/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
       │ at Parser.parse (/home/tosti/Tosti_/kibana_7.8.2/kibana/node_modules/webpack/lib/Parser.js:2280:26)
       │ at doBuild.err (/home/tosti/Tosti_/kibana_7.8.2/kibana/node_modules/webpack/lib/NormalModule.js:482:32)
       │ at runLoaders (/home/tosti/Tosti_/kibana_7.8.2/kibana/node_modules/webpack/lib/NormalModule.js:358:12)
       │ at /home/tosti/Tosti_/kibana_7.8.2/kibana/node_modules/loader-runner/lib/LoaderRunner.js:373:3
       │ at iterateNormalLoaders (/home/tosti/Tosti_/kibana_7.8.2/kibana/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
       │ at Array.<anonymous> (/home/tosti/Tosti_/kibana_7.8.2/kibana/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
       │ at Storage.finished (/home/tosti/Tosti_/kibana_7.8.2/kibana/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
       │ at provider (/home/tosti/Tosti_/kibana_7.8.2/kibana/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
       │ at /home/tosti/Tosti_/kibana_7.8.2/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/react-editor-js/dist/react-editor-js.umd.js 2:110-139
       │ @ ./public/components/editor/main.js
       │ @ ./public/components/editor/index.js
       │ @ ./public/containers/editor.js
       │ @ ./public/containers/index.js
       │ @ ./public/components/app.tsx
       │ @ ./public/application.tsx
       │ @ ./public/plugin.ts
       │ @ ./public/index.ts

```

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [August 4, 2020, 3:09am UTC](https://discuss.elastic.co/t/new-platform-plugin-disallowed-syntax-found/243625/2 "2020-08-04T03:09:26Z")

</div>

Hello @AndreaTosti

I think your plugin needs to be built before `node scripts/build_kibana_platform_plugins` can be run. There are some sample plugins in the kibana repo that might help, including this one - `https://github.com/elastic/kibana/tree/master/test/plugin_functional/plugins/management_test_plugin` Take a look at the `package.json` file. As you can see, the typescript compiler is run.

You can also try the plugin generator - `node scripts/generate_plugin.js [name]`

---

<div class="post-metadata">

**Author:** ![AndreaTosti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andreatosti/32/75172_2.png) [@AndreaTosti](https://discuss.elastic.co/u/AndreaTosti)\
**Post date:** [August 17, 2020, 1:28pm UTC](https://discuss.elastic.co/t/new-platform-plugin-disallowed-syntax-found/243625/3 "2020-08-17T13:28:43Z")

</div>

Hi, first of all thanks for the help, i tried to follow your advice but i was not successful.

I solved the problem using a local version of EditorJS, in particular I had to use Babel to switch to a code written in ES5 (more details [here](https://github.com/codex-team/editor.js/issues/1259#issuecomment-669767626))

---

<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:** [September 14, 2020, 1:28pm UTC](https://discuss.elastic.co/t/new-platform-plugin-disallowed-syntax-found/243625/4 "2020-09-14T13:28:59Z")

</div>

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