Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. var webpack = require('webpack');
  2. var HtmlWebpackPlugin = require('html-webpack-plugin');
  3. var path = require('path');
  4. var folders = {
  5. APP: path.resolve(__dirname, '../app'),
  6. BUILD: path.resolve(__dirname, '../build'),
  7. BOWER: path.resolve(__dirname, '../bower_components'),
  8. NPM: path.resolve(__dirname, '../node_modules')
  9. };
  10.  
  11. var config = {
  12. entry: {
  13. app: [
  14. 'webpack/hot/dev-server',
  15. "./js/app.js"
  16. ]
  17. },
  18. debug: true,
  19. resolve: {
  20. extensions: ['', '.js', '.jsx', '.scss'],
  21. alias: {
  22. //'es6-promise': path.join(folders.NPM, 'es6-promise', 'es6-promise.js'),
  23. //'fetch': path.join(folders.NPM, 'whatwg-fetch', 'fetch.js'),
  24. }
  25. },
  26. stats: {
  27. colors: true,
  28. reasons: true,
  29. },
  30. output: {
  31. path: __dirname + '/build',
  32. publicPath: '/',
  33. filename: '[name].[hash].js',
  34. chunkFilename: '[id].[hash].js'
  35. },
  36. module: {
  37. loaders: [
  38. {
  39. test: /\.s?css$/,
  40. exclude: /node_modules/,
  41. loaders: [
  42. 'style',
  43. 'css',
  44. 'autoprefixer?browsers=last 2 version',
  45. 'sass?' + ['outputStyle=nested'].join('&')
  46. ]
  47. },
  48. { test: /\.jsx?$/, loaders: ['react-hot', 'babel'], exclude: /node_modules/ },
  49. { test: /\.json$/, loader: 'json' },
  50. ]
  51. },
  52. plugins: [
  53. new webpack.HotModuleReplacementPlugin(),
  54. new webpack.ProvidePlugin({
  55. 'es6-promise': 'es6-promise',
  56. 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
  57. }),
  58. //new webpack.optimize.CommonsChunkPlugin('app', null, false),
  59. new webpack.NoErrorsPlugin(),
  60. new HtmlWebpackPlugin({
  61. template: path.resolve('./', 'index.html'),
  62. webpackDevServer: '/webpack-dev-server.js'
  63. })
  64. ]
  65. };
  66.  
  67. module.exports = config;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement