diff --git a/packages/grafana-toolkit/README.md b/packages/grafana-toolkit/README.md index 36b9789b7f3..090cedf38f1 100644 --- a/packages/grafana-toolkit/README.md +++ b/packages/grafana-toolkit/README.md @@ -213,11 +213,22 @@ module.exports = { }; ``` -### How do I add 3rd party dependencies that are not npm packages? -You can add such dependencies by putting them in `static` directory in the root of your project. The `static` directory will be copied when building the plugin. +### How do I add third-party dependencies that are not npm packages? +Put them in the `static` directory in the root of your project. The `static` directory is copied when the plugin is built. + +### I am getting this message when I run my plugin: `Unable to dynamically transpile ES module A loader plugin needs to be configured via SystemJS.config({ transpiler: 'transpiler-module' }).` +This error occurs when you bundle your plugin using the `grafana-toolkit plugin:dev` task and your code comments include ES2016 code. + +There are two issues at play: +* The `grafana-toolkit plugin:dev` task does not remove comments from your bundled package. +* Grafana does not support [ES modules](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/). + +If your comments include ES2016 code, then SystemJS v0.20.19, which Grafana uses internally to load plugins, interprets your code as an ESM and fails. + +To fix this error, remove the ES2016 code from your comments. ## Contribute to grafana-toolkit -You can contribute to grafana-toolkit in the by helping develop it or by debugging it. +You can contribute to grafana-toolkit by helping develop it or by debugging it. ### Develop grafana-toolkit Typically plugins should be developed using the `@grafana/toolkit` installed from npm. However, when working on the toolkit, you might want to use the local version. Follow the steps below to develop with a local version: