webpack.config.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. var webpack = require('webpack');
  2. var path = require('path');
  3. var ExtractTextPlugin = require('extract-text-webpack-plugin');
  4. var HtmlWebpackPlugin = require('html-webpack-plugin');
  5. var FaviconsWebpackPlugin = require('favicons-webpack-plugin');
  6. module.exports = {
  7. entry: [
  8. //'webpack-dev-server/client?http://localhost:3000',
  9. //'webpack/hot/dev-server',
  10. //'./i18nliner.js',
  11. './src/index.js'
  12. ],
  13. devtool: 'eval',
  14. output: {
  15. path: path.join(__dirname, 'dist'),
  16. filename: 'bundle.js'
  17. },
  18. resolve: {
  19. extensions: ['', '.js', '.jsx', '.css'],
  20. modules: ['node_modules', 'src'],
  21. alias : {
  22. 'flags.css' : path.join(__dirname, 'node_modules/flag-icon-css/css/flag-icon.min.css')
  23. }
  24. },
  25. module: {
  26. loaders: [{
  27. test: /\.jsx?$/,
  28. exclude: /(node_modules)/,
  29. loaders: ['babel']
  30. }, {
  31. test: /\.css$/,
  32. loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
  33. }, {
  34. test: /\.scss$/,
  35. loaders: ['style', 'css', 'postcss-loader',
  36. "sass?outputStyle=expanded&"
  37. ]
  38. },{
  39. test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
  40. loader: "file"
  41. }, {
  42. test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  43. loader: "url-loader?limit=10000&mimetype=application/font-woff"
  44. }, {
  45. test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
  46. loader: "url?limit=10000&mimetype=application/octet-stream"
  47. }, {
  48. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  49. loader: "url?limit=10000&mimetype=image/svg+xml"
  50. }, {
  51. test: /\.gif/,
  52. loader: "url-loader?limit=10000&mimetype=image/gif"
  53. }, {
  54. test: /\.jpg/,
  55. loader: "url-loader?limit=10000&mimetype=image/jpg"
  56. }, {
  57. test: /\.png/,
  58. loader: "url-loader?limit=10000&mimetype=image/png"
  59. },{
  60. test : /\.json/,
  61. loader: "json-loader"
  62. }
  63. ]
  64. },
  65. devServer: {
  66. contentBase: "./dist",
  67. hot: true,
  68. inline: true,
  69. port: 3000,
  70. historyApiFallback: true
  71. },
  72. plugins: [
  73. new webpack.NoErrorsPlugin(),
  74. new webpack.HotModuleReplacementPlugin(),
  75. new ExtractTextPlugin('bundle.css'),
  76. new HtmlWebpackPlugin({
  77. title : 'Rate-It',
  78. template : './template/index.ejs',
  79. inject: false
  80. }),
  81. new FaviconsWebpackPlugin('./images/favicon.png'),
  82. new webpack.DefinePlugin({
  83. 'process.env.NODE_ENV': JSON.stringify('development')
  84. })
  85. ]
  86. };