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.

68 lines
1.6 KiB

7 years ago
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
function resolve(dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
target: 'node',
context: resolve('src'),
entry: {
'./module': './module.ts',
'./panel/graph_panel/module': './panel/graph_panel/graph_ctrl.ts'
},
7 years ago
output: {
filename: '[name].js',
7 years ago
path: resolve('dist'),
libraryTarget: 'amd'
7 years ago
},
externals: [
// remove the line below if you don't want to use buildin versions
'lodash', 'moment', 'angular',
7 years ago
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: 'img/*' },
{ from: 'panel/graph_panel/plugin.json', to: 'panel/graph_panel/plugin.json' },
{ from: 'panel/graph_panel/partials/*' }
7 years ago
])
],
resolve: {
extensions: ['.ts', '.js'],
7 years ago
},
module: {
rules: [
{
test: /\.tsx?$/,
loaders: [
'ts-loader'
7 years ago
],
exclude: /node_modules/,
},
{
test: /jquery\.flot\.(?!events)/,
loaders: [
'imports-loader?jQuery=jquery'
]
},
{
test: /jquery\.flot\.events/,
loaders: [
'imports-loader?jQuery=jquery,lodash=lodash,angular=angular,tetherDrop=tether-drop'
]
7 years ago
}
]
}
}