Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. const webpack = require('webpack');
  2. const path = require('path');
  3.  
  4. // 環境を記述 development or production
  5. const env = 'development';
  6.  
  7. const config = {
  8. entry: './entry.jsx',
  9. output: {
  10. path: path.join(__dirname, '/dist'),
  11. filename: 'bundle.js',
  12. },
  13. module: {
  14. loaders: [
  15. {
  16. test: /\.jsx$/,
  17. loader: 'babel-loader',
  18. exclude: /node_modules/,
  19. query: {
  20. presets: ['react', 'es2015']
  21. }
  22. }
  23. ]
  24. },
  25. resolve: {
  26. extensions: ['*', '.js', '.jsx']
  27. },
  28. plugins: [
  29. new webpack.EnvironmentPlugin({
  30. NODE_ENV: env
  31. }),
  32. ],
  33. devtool: 'source-map'
  34. };
  35.  
  36. // Production ビルドの場合は圧縮する
  37. if (env === 'production') {
  38. config.plugins.push(
  39. new webpack.optimize.UglifyJsPlugin({
  40. compress: {
  41. warnings: false
  42. }
  43. })
  44. );
  45. }
  46.  
  47. module.exports = config;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement