oncall-engine/grafana-plugin/webpack.config.ts
Dominik Broj c2ffd28675
Snow outgoing webhooks tab (#3918)
# What this PR does
- implement visual part of ServiceNow Outgoing Tab
- reuse created components on outgoing webhooks page
- make yarn:lint:fix to remove unused imports
- fix live reload during development
- remove unused babel dependencies

## Which issue(s) this PR fixes
- https://github.com/grafana/oncall/issues/3408
- partially https://github.com/grafana/oncall-private/issues/2462

## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2024-02-26 13:52:26 +00:00

57 lines
1.4 KiB
TypeScript

import { Configuration, DefinePlugin, EnvironmentPlugin } from 'webpack';
import LiveReloadPlugin from 'webpack-livereload-plugin';
import { mergeWithRules, CustomizeRule } from 'webpack-merge';
import grafanaConfig from './.config/webpack/webpack.config';
const dotenv = require('dotenv');
const config = async (env): Promise<Configuration> => {
const baseConfig = await grafanaConfig(env);
const customConfig = {
module: {
rules: [
{
test: /\.[tj]sx?$/,
use: {
options: {
jsc: {
parser: {
decorators: true,
},
},
},
},
},
],
},
watchOptions: {
ignored: ['**/node_modules/', '**/dist'],
},
plugins: [
...(baseConfig.plugins?.filter((plugin) => !(plugin instanceof LiveReloadPlugin)) || []),
...(env.development ? [new LiveReloadPlugin({ appendScriptTag: true, useSourceHash: true })] : []),
new EnvironmentPlugin({
ONCALL_API_URL: null,
}),
new DefinePlugin({
'process.env': JSON.stringify(dotenv.config().parsed),
}),
],
};
return mergeWithRules({
module: {
rules: {
test: CustomizeRule.Match,
use: CustomizeRule.Merge,
},
},
watchOptions: {
use: CustomizeRule.Merge,
},
plugins: CustomizeRule.Replace,
})(baseConfig, customConfig);
};
export default config;