webpack.config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const path = require('path')
  2. const webpack = require('webpack')
  3. const TerserJSPlugin = require('terser-webpack-plugin')
  4. module.exports = {
  5. mode: 'production',
  6. entry: './dist/index.js',
  7. output: {
  8. path: path.resolve(__dirname, './lib'),
  9. publicPath: '/lib/',
  10. filename: 'vue-picker.js',
  11. library: 'vue-picker',
  12. libraryTarget: 'umd',
  13. umdNamedDefine: true
  14. },
  15. devtool: 'none',
  16. module: {
  17. rules: [
  18. {
  19. test: /\.js$/,
  20. use: {
  21. loader: 'babel-loader',
  22. options: {
  23. presets: ['@babel/preset-env']
  24. }
  25. },
  26. exclude: /node_modules/
  27. },
  28. ]
  29. },
  30. optimization: {
  31. minimizer: [
  32. new TerserJSPlugin({
  33. parallel: true,
  34. sourceMap: false,
  35. terserOptions: {
  36. compress: {
  37. inline: 1, // https://github.com/mishoo/UglifyJS2/issues/2842
  38. warnings: false,
  39. drop_console: true,
  40. drop_debugger: true
  41. },
  42. output: {
  43. comments: false
  44. }
  45. }
  46. })
  47. ]
  48. }
  49. }