diff --git a/packages/grafana-toolkit/README.md b/packages/grafana-toolkit/README.md index cd9938616ea..bbb06243b36 100644 --- a/packages/grafana-toolkit/README.md +++ b/packages/grafana-toolkit/README.md @@ -300,6 +300,24 @@ If your comments include ES2016 code, then SystemJS v0.20.19, which Grafana uses To fix this error, remove the ES2016 code from your comments. +### I would like to dynamically import modules in my plugin + +Create a webpack.config.js with this content (in the root of _your_ plugin) + +```ts +// webpack.config.js +const pluginJson = require('./src/plugin.json'); +module.exports.getWebpackConfig = (config, options) => ({ + ...config, + output: { + ...config.output, + publicPath: `public/plugins/${pluginJson.id}/`, + }, +}); +``` + +The plugin id is the id written in the plugin.json file. + ## Contribute to grafana-toolkit You can contribute to grafana-toolkit by helping develop it or by debugging it.