Posted By

klachkoalexander on 11/09/16


Tagged

112


Versions (?)

webpac.config


 / Published in: JavaScript
 

my snipplet

  1. 'use strict';
  2.  
  3. const NODE_ENV = process.env.NODE_ENV || 'development';
  4. const webpack = require('webpack');
  5.  
  6. module.exports = {
  7. entry: "./home",
  8. output: {
  9. filename: "build.js",
  10. library: "home"
  11. },
  12. watch: NODE_ENV == 'development',
  13.  
  14. watchOptions: {
  15. aggregateTimeout: 100
  16. },
  17.  
  18. devtool: NODE_ENV == 'development' ? "cheap-source-map" : null,
  19.  
  20. plugins: [
  21. new webpack.DefinePlugin({
  22. NODE_ENV: JSON.stringify(NODE_ENV),
  23. LANG: JSON.stringify('ru')
  24. })
  25. ],
  26.  
  27.  
  28. module: {
  29. loaders: [
  30. {test: /\.js$/,
  31. loader: 'babel?presets[]=es2015'
  32. }]
  33. }
  34. };
  35.  
  36. if(NODE_ENV == 'production'){
  37. module.exports.plugins.push(
  38. new webpack.optimize.UglifyJsPlugin({
  39. compress : {
  40. warnings : false,
  41. drop_console: true
  42. }
  43. })
  44. )
  45. }

Report this snippet  

You need to login to post a comment.