Guest User

Untitled

a guest
Jun 28th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. var webpack = require('webpack');
  2. var path = require('path');
  3. var config_webpath_dev = require('./configs/webpack_dev');
  4. var ExtractTextPlugin = require('extract-text-webpack-plugin');
  5. var ext2 = require('extract-text-webpack-plugin');
  6. var extractSCSS = new ExtractTextPlugin('build.scss');
  7. var extractCSS = new ExtractTextPlugin('main.css');
  8. var config = {
  9. devtool: 'eval',
  10. entry: __dirname + '/app/App.js',
  11. resolve: {root: [__dirname + "/sass"]},
  12. output: {
  13. path: __dirname + '/public',
  14. filename: "bundle.js"
  15. },
  16. plugins: [
  17. new webpack.HotModuleReplacementPlugin()
  18. ],
  19. target: 'node',
  20. module: {
  21. loaders: [
  22. {
  23. test: /\.jsx?$/,
  24. loader: 'babel',
  25. exclude: /(node_modules|bower_components)/
  26. },
  27. { test: /\.scss$/i, loader: extractSCSS.extract('style','css!sass')},
  28. { test: /\.css$/i, loader:extractCSS.extract('style','css')},
  29. {
  30. test: /\.json$/,
  31. loader: 'json-loader',
  32. },
  33. {test: /\.(png|jpg)$/, loader: 'file-loader'},
  34. {test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff"},
  35. {test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff"},
  36. {test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream"},
  37. {test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file"},
  38. {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml"}
  39. ]
  40. },
  41. devServer: {
  42. contentBase: "./public",
  43. colors: true,
  44. historyApiFallback: true,
  45. inline: true,
  46. hot: true,
  47. host: config_webpath_dev.domain,
  48. port: config_webpath_dev.port
  49. },
  50. }
  51.  
  52. /*
  53. * If bundling for production, optimize output
  54. */
  55. if (process.env.NODE_ENV === 'production') {
  56. config.devtool = false;
  57. config.plugins = [
  58. new webpack.optimize.OccurenceOrderPlugin(),
  59. new webpack.optimize.UglifyJsPlugin({comments: false}),
  60. new webpack.DefinePlugin({
  61. 'process.env': {NODE_ENV: JSON.stringify('production')}
  62. }),
  63. extractSCSS,
  64. extractCSS,
  65. new webpack.DefinePlugin({
  66. 'process.env.BROWSER': JSON.stringify(true),
  67. 'global': {}, // bizarre lodash(?) webpack workaround
  68. 'global.GENTLY': false // superagent client fix
  69. }),
  70. ];
  71. }
  72. ;
  73.  
  74. module.exports = config;
Add Comment
Please, Sign In to add comment