mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 05:29:42 -06:00
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
'use strict';
|
|
|
|
const merge = require('webpack-merge');
|
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
|
const common = require('./webpack.common.js');
|
|
const webpack = require('webpack');
|
|
const path = require('path');
|
|
const ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
|
|
module.exports = merge(common, {
|
|
devtool: "source-map",
|
|
|
|
entry: {
|
|
dark: './public/sass/grafana.dark.scss',
|
|
light: './public/sass/grafana.light.scss',
|
|
vendor: require('./dependencies'),
|
|
},
|
|
|
|
module: {
|
|
rules: [
|
|
require('./sass.rule.js')({
|
|
sourceMap: false, minimize: true
|
|
})
|
|
]
|
|
},
|
|
|
|
devServer: {
|
|
noInfo: true,
|
|
stats: {
|
|
chunks: false,
|
|
},
|
|
},
|
|
|
|
plugins: [
|
|
new ExtractTextPlugin({
|
|
filename: 'grafana.[name].css',
|
|
}),
|
|
new ngAnnotatePlugin(),
|
|
new UglifyJSPlugin({
|
|
sourceMap: true,
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
'process.env': {
|
|
'NODE_ENV': JSON.stringify('production')
|
|
}
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
filename: path.resolve(__dirname, '../../public/views/index.html'),
|
|
template: path.resolve(__dirname, '../../public/views/index.template.html'),
|
|
inject: 'body',
|
|
chunks: ['manifest', 'vendor', 'app'],
|
|
}),
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
names: ['vendor', 'manifest'],
|
|
}),
|
|
function() {
|
|
this.plugin("done", function(stats) {
|
|
if (stats.compilation.errors && stats.compilation.errors.length) {
|
|
console.log(stats.compilation.errors);
|
|
process.exit(1);
|
|
}
|
|
});
|
|
}
|
|
]
|
|
});
|