webpack.conf.js 643 B

12345678910111213141516171819202122232425262728293031
  1. const webpack = require('webpack')
  2. const path = require('path')
  3. const pkg = require('../package.json')
  4. const rootPath = path.resolve(__dirname, '../')
  5. const config = {
  6. entry: path.resolve(rootPath, 'src', 'index.js'),
  7. output: {
  8. filename: `${pkg.name}.min.js`,
  9. path: path.resolve(rootPath, 'build'),
  10. library: `${pkg.name}`,
  11. libraryTarget: 'umd'
  12. },
  13. module: {
  14. rules: [{
  15. test: /\.js$/,
  16. loader: 'babel-loader'
  17. }]
  18. },
  19. plugins: [
  20. new webpack.optimize.UglifyJsPlugin({
  21. compress: {screw_ie8: false},
  22. mangle: {except: ['$']},
  23. support_ie8: true
  24. })
  25. ]
  26. }
  27. module.exports = config