Personal Dashboard

webpack.config.js 1.6KB

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