webpack.dev.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 'use strict';
  2. const merge = require('webpack-merge');
  3. const common = require('./webpack.common.js');
  4. const path = require('path');
  5. const webpack = require('webpack');
  6. const HtmlWebpackPlugin = require("html-webpack-plugin");
  7. const ExtractTextPlugin = require("extract-text-webpack-plugin");
  8. const WebpackCleanupPlugin = require('webpack-cleanup-plugin');
  9. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  10. module.exports = merge(common, {
  11. devtool: "cheap-module-source-map",
  12. entry: {
  13. dark: './public/sass/grafana.dark.scss',
  14. light: './public/sass/grafana.light.scss',
  15. vendor: require('./dependencies'),
  16. },
  17. module: {
  18. rules: [
  19. require('./sass.rule.js')({
  20. sourceMap: false, minimize: false
  21. })
  22. ]
  23. },
  24. plugins: [
  25. new ExtractTextPlugin({ // define where to save the file
  26. filename: 'grafana.[name].css',
  27. allChunks: true,
  28. }),
  29. new HtmlWebpackPlugin({
  30. filename: path.resolve(__dirname, '../../public/views/index.html'),
  31. template: path.resolve(__dirname, '../../public/views/index.template.html'),
  32. inject: 'body',
  33. chunks: ['manifest', 'vendor', 'app'],
  34. }),
  35. new webpack.DefinePlugin({
  36. 'process.env': {
  37. 'NODE_ENV': JSON.stringify('development')
  38. }
  39. }),
  40. new webpack.optimize.CommonsChunkPlugin({
  41. names: ['vendor', 'manifest'],
  42. }),
  43. // new BundleAnalyzerPlugin({
  44. // analyzerPort: 8889
  45. // })
  46. ]
  47. });