webpack.config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const webpack = require('webpack');
  2. const Visualizer = require('webpack-visualizer-plugin');
  3. module.exports = {
  4. context: __dirname + '/src/frontend/js',
  5. entry: './main.js',
  6. output: {
  7. filename: 'main.js',
  8. path: __dirname + '/dist/js',
  9. publicPath: '/js/',
  10. sourceMapFilename: 'dnBOUAwY76qx3MmZxtHn.map'
  11. },
  12. module: {
  13. loaders: [
  14. {
  15. test: /\.js$/,
  16. exclude: /(node_modules|bower_components)/,
  17. loader: 'babel-loader',
  18. query: {
  19. presets: ['@babel/es2015']
  20. }
  21. },
  22. {
  23. test: /\.ejs$/,
  24. loader: 'ejs-loader'
  25. }
  26. ]
  27. },
  28. plugins: [
  29. new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
  30. new webpack.optimize.LimitChunkCountPlugin({
  31. maxChunks: 1
  32. }),
  33. new webpack.ProvidePlugin({
  34. $: 'jquery',
  35. jQuery: 'jquery',
  36. _: 'underscore'
  37. }),
  38. new Visualizer({
  39. filename: '../../webpack_stats.html'
  40. }),
  41. new webpack.optimize.UglifyJsPlugin({
  42. compress: {
  43. unsafe: true,
  44. drop_console: false,
  45. drop_debugger: true,
  46. screw_ie8: true,
  47. warnings: false
  48. }
  49. })
  50. ]
  51. };