webpack.common.config.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const webpack = require('webpack');
  2. const helpers = require('./helpers');
  3. /*
  4. * Webpack Plugins
  5. */
  6. // problem with copy-webpack-plugin
  7. const AssetsPlugin = require('assets-webpack-plugin');
  8. const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
  9. const CopyWebpackPlugin = require('copy-webpack-plugin');
  10. const HtmlWebpackPlugin = require('html-webpack-plugin');
  11. const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
  12. const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
  13. /*
  14. * Webpack Constants
  15. */
  16. const HMR = helpers.hasProcessFlag('hot');
  17. /*
  18. * Webpack configuration
  19. *
  20. * See: http://webpack.github.io/docs/configuration.html#cli
  21. */
  22. module.exports = function (options) {
  23. isProd = options.env === 'production';
  24. return {
  25. entry: {
  26. 'app': './resource/js/app.js',
  27. 'crowi-legacy': './resource/js/legacy/crowi.js',
  28. 'presentation': './resource/js/crowi-presentation.js',
  29. },
  30. resolve: {
  31. modules: [
  32. './node_modules', './resource/thirdparty-js',
  33. ],
  34. },
  35. module: {
  36. rules: [
  37. {
  38. test: /.jsx?$/,
  39. exclude: /node_modules/,
  40. use: [{
  41. loader: 'babel-loader',
  42. }]
  43. }
  44. ]
  45. },
  46. plugins: []
  47. }
  48. }
  49. module.exports = config;