webpack.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const staticPath = path.resolve(__dirname, '..', 'src', 'sentry', 'static', 'sentry');
  4. const componentPath = path.resolve(staticPath, 'app', 'components');
  5. const sentryConfig = require('../webpack.config');
  6. const appConfig = sentryConfig[0];
  7. const legacyCssConfig = sentryConfig[1];
  8. module.exports = {
  9. module: {
  10. rules: [
  11. {
  12. test: /\.po$/,
  13. loader: 'po-catalog-loader',
  14. query: {
  15. referenceExtensions: ['.js', '.jsx'],
  16. domain: 'sentry'
  17. }
  18. },
  19. {
  20. test: /\.css$/,
  21. use: ['style-loader', 'css-loader']
  22. },
  23. {
  24. test: /\.less$/,
  25. use: [
  26. {
  27. loader: 'style-loader'
  28. },
  29. {
  30. loader: 'css-loader'
  31. },
  32. {
  33. loader: 'less-loader'
  34. }
  35. ]
  36. },
  37. {
  38. test: /\.(woff|woff2|ttf|eot|svg|png|gif|ico|jpg)($|\?)/,
  39. loader: 'file-loader?name=' + '[name].[ext]'
  40. }
  41. ]
  42. },
  43. plugins: [
  44. new webpack.ProvidePlugin({
  45. $: 'jquery',
  46. jQuery: 'jquery',
  47. 'window.jQuery': 'jquery',
  48. 'root.jQuery': 'jquery',
  49. Raven: 'raven-js',
  50. underscore: 'underscore',
  51. _: 'underscore'
  52. })
  53. ],
  54. resolve: {
  55. alias: Object.assign({}, appConfig.resolve.alias, {
  56. 'sentry-ui': componentPath
  57. })
  58. }
  59. };