Advertisement
Guest User

Untitled

a guest
May 26th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. // webpack
  2. var webpack = require('webpack');
  3.  
  4. module.exports = {
  5. devtool:'source-map',
  6. entry: [
  7. './src/index.js',
  8. ],
  9. output: {
  10. path: __dirname,
  11. publicPath: '/',
  12. filename: 'bundle.js'
  13. },
  14. module: {
  15. loaders: [
  16. {
  17. exclude: /node_modules/,
  18. loaders: ['react-hot','babel']
  19. },
  20. { test: /\.css$/, loader: "style!css" },
  21. {test: /\.json$/, loader: 'json-loader'},
  22. {
  23. test: /\.(jpe?g|png|gif|svg)$/i,
  24. loaders: [
  25. 'file?hash=sha512&digest=hex&name=[hash].[ext]',
  26. 'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
  27. ]
  28. },
  29. {
  30. test: /masonry|imagesloaded|fizzy\-ui\-utils|desandro\-|outlayer|get\-size|doc\-ready|eventie|eventemitter/,
  31. loader: 'imports?define=>false&this=>window'
  32. }
  33. ]
  34. },
  35. resolve: {
  36. extensions: ['', '.js', '.jsx']
  37. },
  38.  
  39. devServer: {
  40. port:8080,
  41. historyApiFallback: true,
  42. contentBase: './'
  43. }
  44. };
  45.  
  46. //server
  47. app.get('/dbmt/*', function(req, res,next) {
  48. //console.log(path.resolve('../', 'client/dbmt', 'index.html'));
  49. console.log(req.originalUrl);
  50. var skip = ['.css','.js','.html'];
  51. var match = false;
  52. skip.map(function(ext) {
  53. if (req.originalUrl.indexOf(ext) > 0) {
  54. match = true;
  55. }
  56. })
  57. if (match) {
  58. next();
  59. } else {
  60. res.sendFile(path.resolve('../', 'client/dbmt', 'index.html'));
  61. }
  62. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement