Files
grafana-zabbix/webpack/webpack.base.conf.js
Alexander Zobnin 9b2079c1da Migrate problems panel to React (#1532)
* Replace default angular app config editor

* Problems panel: migrate module to ts

* Problems panel options editor to react

* Problems panel react WIP

* Fix explore button

* Problems panel alert list layout WIP

* Refactor

* Minor tweaks on panel options

* remove outdated tests

* Update typescript

* Draft for tag event handling

* Remove unused files
2022-11-30 14:01:21 +03:00

136 lines
3.3 KiB
JavaScript

const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
// const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ExtractTextPluginLight = new ExtractTextPlugin('./css/grafana-zabbix.light.css');
const ExtractTextPluginDark = new ExtractTextPlugin('./css/grafana-zabbix.dark.css');
function resolve(dir) {
return path.join(__dirname, '..', dir);
}
module.exports = {
target: 'node',
context: resolve('src'),
entry: {
'module': './module.ts',
'datasource-zabbix/module': './datasource-zabbix/module.ts',
'panel-triggers/module': './panel-triggers/module.tsx',
},
output: {
filename: "[name].js",
path: resolve('dist'),
libraryTarget: "amd"
},
externals: [
// remove the line below if you don't want to use builtin versions
'lodash',
'jquery',
'moment',
'slate',
'emotion',
'@emotion/react',
'@emotion/css',
'prismjs',
'slate-plain-serializer',
'@grafana/slate-react',
'react',
'react-dom',
'react-redux',
'redux',
'rxjs',
'react-router-dom',
'd3',
'angular',
'@grafana/ui',
'@grafana/runtime',
'@grafana/data',
'monaco-editor',
'react-monaco-editor',
function (context, request, callback) {
var prefix = 'grafana/';
if (request.indexOf(prefix) === 0) {
return callback(null, request.substr(prefix.length));
}
callback();
}
],
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new CopyWebpackPlugin([
{ from: '**/plugin.json' },
{ from: '**/*.html' },
{ from: '**/*.md' },
{ from: '../dashboards/*', to: 'datasource-zabbix/dashboards' },
{ from: '../README.md' },
{ from: '**/img/*' },
]),
ExtractTextPluginLight,
ExtractTextPluginDark,
],
resolve: {
extensions: ['.js', '.es6', '.ts', '.tsx', '.html', '.scss']
},
module: {
rules: [
{
test: /\.tsx?$/,
loaders: [
{
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { modules: false }]],
plugins: ['angularjs-annotate'],
sourceMaps: true,
},
},
{
loader: 'ts-loader',
options: {
onlyCompileBundledFiles: true,
transpileOnly: true,
},
},
],
exclude: /(node_modules)/,
},
{
test: /\.jsx?$/,
loaders: [
{
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { modules: false }]],
plugins: ['angularjs-annotate'],
sourceMaps: true,
},
},
],
exclude: /(node_modules)/,
},
{
test: /\.html$/,
use: {
loader: 'html-loader'
}
},
{
test: /\.light\.scss$/,
use: ExtractTextPluginLight.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
},
{
test: /\.dark\.scss$/,
use: ExtractTextPluginDark.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
},
]
}
};