The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/scripts/webpack/rules.ts

62 lines
1.5 KiB

import browserslist from 'browserslist';
import type { LoaderOptions } from 'esbuild-loader';
import { resolveToEsbuildTarget } from 'esbuild-plugin-browserslist';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import type { RuleSetRule } from 'webpack';
const esbuildTargets = resolveToEsbuildTarget(browserslist(), { printUnknownTargets: false });
// esbuild-loader 3.0.0+ requires format to be set to prevent it
// from defaulting to 'iife' which breaks monaco/loader once minified.
export const esbuildOptions: LoaderOptions = {
target: esbuildTargets,
format: undefined,
jsx: 'automatic',
};
export const esbuildRule: RuleSetRule = {
test: /\.tsx?$/,
use: {
loader: 'esbuild-loader',
options: esbuildOptions,
},
};
export const sassRule: RuleSetRule = {
test: /\.(sa|sc|c)ss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: './',
},
},
{
loader: 'css-loader',
options: {
importLoaders: 2,
url: true,
sourceMap: false,
},
},
{
loader: 'postcss-loader',
options: {
sourceMap: false,
postcssOptions: {
config: import.meta.dirname,
},
},
},
{
loader: 'sass-loader',
options: {
sourceMap: false,
sassOptions: {
// silencing these warnings since we're planning to remove sass when angular is gone
silenceDeprecations: ['import', 'global-builtin'],
},
},
},
],
};