You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

75 line
1.8 KiB

  1. /*!
  2. * Facebook React Starter Kit | https://github.com/kriasoft/react-starter-kit
  3. * Copyright (c) KriaSoft, LLC. All rights reserved. See LICENSE.txt
  4. */
  5. /*
  6. * Webpack configuration. For more information visit
  7. * http://webpack.github.io/docs/configuration
  8. */
  9. 'use strict';
  10. var webpack = require('webpack');
  11. module.exports = function (release) {
  12. return {
  13. cache: !release,
  14. debug: !release,
  15. devtool: false,
  16. entry: {
  17. 'reactAutoComplete' : './src/index.js',
  18. 'reactAutoComplete.min' : './src/index.js'
  19. },
  20. output: {
  21. path: './lib/',
  22. filename: '[name].js',
  23. publicPatch: './lib/',
  24. // export itself to UMD Module
  25. libraryTarget: "umd",
  26. // name of the global var: "ReactAutocomplete"
  27. library: "ReactAutocomplete"
  28. },
  29. externals: {
  30. "react": {
  31. root : 'React',
  32. commonjs : 'react',
  33. commonjs2 : 'react',
  34. amd : 'react'
  35. },
  36. "react-dom": {
  37. root: 'ReactDOM',
  38. commonjs: 'react-dom',
  39. commonjs2: 'react-dom',
  40. amd: 'react-dom'
  41. }
  42. },
  43. stats: {
  44. colors: true,
  45. reasons: !release
  46. },
  47. plugins: release ? [
  48. new webpack.DefinePlugin({'process.env.NODE_ENV': '"production"'}),
  49. new webpack.optimize.DedupePlugin(),
  50. new webpack.optimize.UglifyJsPlugin({
  51. include: /\.min\.js$/,
  52. compress: { warnings: false }
  53. }),
  54. new webpack.optimize.OccurenceOrderPlugin(),
  55. new webpack.optimize.AggressiveMergingPlugin()
  56. ] : [],
  57. resolve: {
  58. extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx']
  59. },
  60. module: {
  61. loaders: [
  62. { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }
  63. ]
  64. }
  65. };
  66. };