How to override default webpack configuration?

Hi, everyone!

I need to override the default webpack configuration in my custom panel plugin. How to do this?

Thanks in advance!

Here is the solution I found in Grafana toolkit readme.

You can provide your own webpack configuration.
Provide a function implementing CustomWebpackConfigurationGetter in a file named webpack.config.ts.

You can import the correct interface and Options from @grafana/toolkit/src/config.


import { CustomWebpackConfigurationGetter } from '@grafana/toolkit/src/config'
import CustomPlugin from 'custom-plugin';
const getWebpackConfig: CustomWebpackConfigurationGetter = (defaultConfig, options) => {
    console.log('Custom config');
    defaultConfig.plugins.push(new CustomPlugin())
    return defaultConfig;
export = getWebpackConfig;