webpack.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. var path = require('path');
  2. var webpack = require('webpack');
  3. var config = {
  4. entry: {
  5. app: './resource/js/app.js',
  6. crowi: './resource/js/crowi.js',
  7. presentation: './resource/js/crowi-presentation.js',
  8. form: './resource/js/crowi-form.js',
  9. admin: './resource/js/crowi-admin.js',
  10. },
  11. output: {
  12. path: path.join(__dirname + "/public/js"),
  13. filename: "[name].js"
  14. },
  15. resolve: {
  16. modulesDirectories: [
  17. './node_modules', './resource/thirdparty-js',
  18. ],
  19. },
  20. module: {
  21. loaders: [
  22. {
  23. test: /.jsx?$/,
  24. loader: 'babel-loader',
  25. exclude: /node_modules/,
  26. query: {
  27. presets: ['es2015', 'react']
  28. }
  29. }
  30. ]
  31. },
  32. plugins: []
  33. };
  34. if (process.env && process.env.NODE_ENV !== 'development') {
  35. config.plugins = [
  36. new webpack.DefinePlugin({
  37. 'process.env':{
  38. 'NODE_ENV': JSON.stringify('production')
  39. }
  40. }),
  41. new webpack.optimize.UglifyJsPlugin({
  42. compress:{
  43. warnings: false
  44. }
  45. }),
  46. ];
  47. }
  48. module.exports = config;