webpack.config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. var path = require("path"),
  2. webpack = require("webpack");
  3. var staticPrefix = "src/sentry/static/sentry",
  4. distPath = staticPrefix + "/dist";
  5. var config = {
  6. context: path.join(__dirname, staticPrefix),
  7. entry: {
  8. "app": "app",
  9. "vendor": [
  10. "babel-core/polyfill",
  11. "bootstrap/js/dropdown",
  12. "bootstrap/js/tab",
  13. "bootstrap/js/tooltip",
  14. "crypto-js/md5",
  15. "jquery",
  16. "moment",
  17. "raven-js",
  18. "react/addons",
  19. "react-datepicker",
  20. "react-document-title",
  21. "react-router",
  22. "react-bootstrap",
  23. "reflux",
  24. "selectize",
  25. "flot/jquery.flot",
  26. "flot/jquery.flot.stack",
  27. "flot/jquery.flot.time",
  28. "flot-tooltip/jquery.flot.tooltip",
  29. "vendor/simple-slider/simple-slider"
  30. ]
  31. },
  32. module: {
  33. loaders: [
  34. {
  35. test: /\.jsx?$/,
  36. loader: "babel-loader",
  37. include: path.join(__dirname, staticPrefix),
  38. exclude: /(vendor|node_modules)/
  39. }
  40. ]
  41. },
  42. plugins: [
  43. new webpack.optimize.CommonsChunkPlugin("vendor", distPath + "/vendor.js"),
  44. new webpack.optimize.UglifyJsPlugin(),
  45. new webpack.optimize.DedupePlugin(),
  46. new webpack.ProvidePlugin({
  47. $: 'jquery',
  48. jQuery: 'jquery',
  49. "window.jQuery": "jquery",
  50. "root.jQuery": "jquery"
  51. })
  52. ],
  53. resolve: {
  54. alias: {
  55. "flot": path.join(__dirname, staticPrefix, "vendor", "jquery-flot"),
  56. "flot-tooltip": path.join(__dirname, staticPrefix, "vendor", "jquery-flot-tooltip"),
  57. },
  58. modulesDirectories: [path.join(__dirname, staticPrefix), "node_modules"],
  59. extensions: ["", ".jsx", ".js", ".json"]
  60. },
  61. output: {
  62. filename: distPath + "/[name].js",
  63. libraryTarget: "var",
  64. library: "exports"
  65. },
  66. devtool: 'source-map'
  67. };
  68. module.exports = config;