Personal Dashboard

webpack.config.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. const webpack = require('webpack');
  2. var ExtractTextPlugin = require('extract-text-webpack-plugin')
  3. const config = {
  4. entry: [
  5. './src/index.js',
  6. ],
  7. output: {
  8. path: __dirname + '/dist',
  9. publicPath: '/',
  10. filename: 'bundle.js'
  11. },
  12. module: {
  13. loaders: [
  14. {
  15. test: /\.jsx?$/,
  16. exclude: /node_modules/,
  17. loader: 'react-hot-loader!babel-loader'
  18. },
  19. {
  20. test: /\.s?css$/,
  21. loader: ExtractTextPlugin.extract({
  22. fallback: 'style-loader',
  23. use: ['css-loader', 'sass-loader']
  24. })
  25. },
  26. {
  27. test: /\.(eot|svg|ttf|woff|woff2)$/,
  28. loader: 'file-loader?name=fonts/[name].[ext]'
  29. }
  30. ]
  31. },
  32. resolve: {
  33. extensions: ['*', '.js', '.jsx']
  34. },
  35. plugins: [
  36. new ExtractTextPlugin({ filename: 'style.css', allChunks: true }),
  37. new webpack.DefinePlugin({
  38. ENV: "'test'"
  39. }),
  40. ],
  41. devServer: {
  42. contentBase: './dist',
  43. hot: true,
  44. historyApiFallback: true
  45. },
  46. }
  47. if (process.env.NODE_ENV !== 'production')
  48. config.entry.push(
  49. 'webpack-dev-server/client?http://localhost:8080',
  50. 'webpack/hot/only-dev-server'
  51. );
  52. module.exports = config