forked from grafana/grafana-zabbix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
68 lines (63 loc) · 1.81 KB
/
webpack.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import type { Configuration } from 'webpack';
import { merge } from 'webpack-merge';
import grafanaConfig from './.config/webpack/webpack.config';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts';
const config = async (env): Promise<Configuration> => {
const baseConfig = await grafanaConfig(env);
return merge(baseConfig, {
// Add custom config here...
entry: {
module: './module.ts',
'datasource/module': './datasource/module.ts',
'panel-triggers/module': './panel-triggers/module.tsx',
dark: './styles/dark.scss',
light: './styles/light.scss',
},
module: {
rules: [
{
test: /(dark|light)\.scss$/,
exclude: /node_modules/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
importLoaders: 1,
url: false,
sourceMap: false,
},
},
{
loader: require.resolve('postcss-loader'),
options: {
postcssOptions: {
plugins: () => [
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: { flexbox: 'no-2009', grid: true },
}),
],
},
},
},
{
loader: 'sass-loader',
options: {
sourceMap: false,
},
},
],
},
],
},
plugins: [
new RemoveEmptyScriptsPlugin({}),
new MiniCssExtractPlugin({
filename: 'styles/[name].css',
}),
],
});
};
export default config;