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.

Example:

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;
2 Likes

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