# What this PR does
New OnCall plugin initialization process
## Checklist
- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
show up in the autogenerated release notes.
---------
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
84 lines
2.1 KiB
TypeScript
84 lines
2.1 KiB
TypeScript
import { Configuration, EnvironmentPlugin } from 'webpack';
|
|
import LiveReloadPlugin from 'webpack-livereload-plugin';
|
|
import { mergeWithRules, CustomizeRule } from 'webpack-merge';
|
|
|
|
import grafanaConfig from './.config/webpack/webpack.config';
|
|
|
|
const config = async (env): Promise<Configuration> => {
|
|
const baseConfig = await grafanaConfig(env);
|
|
const customConfig = {
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.[tj]sx?$/,
|
|
use: {
|
|
options: {
|
|
jsc: {
|
|
parser: {
|
|
decorators: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
test: /\.s[ac]ss$/,
|
|
use: [
|
|
'style-loader',
|
|
{
|
|
loader: 'css-loader',
|
|
options: {
|
|
modules: {
|
|
auto: true,
|
|
localIdentName: env.development ? '[path][name]__[local]' : '[name]__[hash:base64]',
|
|
},
|
|
},
|
|
},
|
|
'sass-loader',
|
|
],
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: [
|
|
'style-loader',
|
|
{
|
|
loader: 'css-loader',
|
|
options: {
|
|
modules: {
|
|
auto: true,
|
|
localIdentName: env.development ? '[path][name]__[local]' : '[name]__[hash:base64]',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
watchOptions: {
|
|
ignored: ['**/node_modules/', '**/dist'],
|
|
},
|
|
plugins: [
|
|
...(baseConfig.plugins?.filter((plugin) => !(plugin instanceof LiveReloadPlugin)) || []),
|
|
...(env.development ? [new LiveReloadPlugin({ appendScriptTag: true, useSourceHash: true })] : []),
|
|
new EnvironmentPlugin({
|
|
NODE_ENV: 'development',
|
|
PLUGIN_ID: 'grafana-oncall-app',
|
|
}),
|
|
],
|
|
};
|
|
|
|
return mergeWithRules({
|
|
module: {
|
|
rules: {
|
|
test: CustomizeRule.Match,
|
|
use: CustomizeRule.Merge,
|
|
},
|
|
},
|
|
watchOptions: {
|
|
use: CustomizeRule.Merge,
|
|
},
|
|
plugins: CustomizeRule.Replace,
|
|
})(baseConfig, customConfig);
|
|
};
|
|
|
|
export default config;
|