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.
 
 
 

63 lines
1.4 KiB

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.ts',
output: {
filename: 'module.js',
path: resolve('dist'),
libraryTarget: 'amd'
},
externals: [
// remove the line below if you don't want to use buildin versions
'lodash', 'moment', 'angular',
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: 'partials/*' }
])
],
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.tsx?$/,
loaders: [
'ts-loader'
],
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'
]
}
]
}
}