mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Docs: Adding details about how to enable dynamic imports in plugins (#41648)
* added dynamic import to the readme. * Update packages/grafana-toolkit/README.md Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com> * Update README.md Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
This commit is contained in:
parent
5c40865547
commit
95e0eea86c
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user