chore: bump @grafana/create-plugin configuration to 5.26.4 (#2082)
Bumps [`@grafana/create-plugin`](https://github.com/grafana/plugin-tools/tree/main/packages/create-plugin) configuration from 4.2.1 to 5.26.4. **Notes for reviewer:** This is an auto-generated PR which ran `@grafana/create-plugin update`. Please consult the create-plugin [CHANGELOG.md](https://github.com/grafana/plugin-tools/blob/main/packages/create-plugin/CHANGELOG.md) to understand what may have changed. Please review the changes thoroughly before merging. --------- Co-authored-by: grafana-plugins-platform-bot[bot] <144369747+grafana-plugins-platform-bot[bot]@users.noreply.github.com> Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
This commit is contained in:
committed by
GitHub
parent
e76741b453
commit
b13d567eee
33
.config/webpack/BuildModeWebpackPlugin.ts
Normal file
33
.config/webpack/BuildModeWebpackPlugin.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import webpack, { type Compiler } from 'webpack';
|
||||
|
||||
const PLUGIN_NAME = 'BuildModeWebpack';
|
||||
|
||||
export class BuildModeWebpackPlugin {
|
||||
apply(compiler: webpack.Compiler) {
|
||||
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
||||
compilation.hooks.processAssets.tap(
|
||||
{
|
||||
name: PLUGIN_NAME,
|
||||
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
|
||||
},
|
||||
async () => {
|
||||
const assets = compilation.getAssets();
|
||||
for (const asset of assets) {
|
||||
if (asset.name.endsWith('plugin.json')) {
|
||||
const pluginJsonString = asset.source.source().toString();
|
||||
const pluginJsonWithBuildMode = JSON.stringify(
|
||||
{
|
||||
...JSON.parse(pluginJsonString),
|
||||
buildMode: compilation.options.mode,
|
||||
},
|
||||
null,
|
||||
4
|
||||
);
|
||||
compilation.updateAsset(asset.name, new webpack.sources.RawSource(pluginJsonWithBuildMode));
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user