Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var path = require("path")
  2. var webpack = require('webpack')
  3. var BundleTracker = require('webpack-bundle-tracker')
  4.  
  5.  
  6. module.exports = {
  7.   context: __dirname,
  8.   entry: [
  9.       'react-hot-loader/patch',
  10.       'webpack-dev-server/client?http://localhost:3000',
  11.       'webpack/hot/only-dev-server',
  12.       './apps/static/js/index'
  13.   ],
  14.  
  15.   output: {
  16.       path: path.resolve('./apps/static/bundles/'),
  17.       filename: '[name]-[hash].js',
  18.       publicPath: 'http://localhost:3000/static/bundles/', // Tell django to use this URL to load packages and not use STATIC_URL + bundle_name
  19.   },
  20.  
  21.   plugins: [
  22.     new webpack.HotModuleReplacementPlugin(),
  23.     new webpack.NoErrorsPlugin(), // don't reload if there is an error
  24.     new BundleTracker({filename: './webpack-stats.json'}),
  25.   ],
  26.  
  27.   module: {
  28.     loaders: [
  29.       // we pass the output from babel loader to react-hot loader
  30.       { test: /\.jsx?$/, exclude: /node_modules/, loaders: ['react-hot', 'babel'], },
  31.     ],
  32.   },
  33.  
  34.   resolve: {
  35.     modulesDirectories: ['node_modules', 'bower_components'],
  36.     extensions: ['', '.js', '.jsx']
  37.   }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement