webpack.pro.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const path = require('path');
  2. const webpackConfigBase = require('./webpack.base.js');
  3. const merge = require("webpack-merge");
  4. const webpack = require('webpack');
  5. const prodConfig = {
  6. entry: {
  7. component: './src/index.js'
  8. },
  9. devtool:'#source-map',
  10. plugins:[
  11. new webpack.DefinePlugin({
  12. 'process.env': {
  13. NODE_ENV: '"production"'
  14. }
  15. }),
  16. new webpack.LoaderOptionsPlugin({
  17. minimize: true
  18. })
  19. ],
  20. externals:{
  21. vue: "Vue",
  22. jquery: "jquery",
  23. moment: "moment",
  24. 'element-ui': 'ELEMENT'
  25. },
  26. output:{
  27. filename: '[name].bundle.js',
  28. path: path.resolve('./public/assets/dist/'),
  29. libraryTarget:'umd',
  30. library:{
  31. root: 'cps',
  32. amd: 'cps',
  33. commonjs: 'cps',
  34. },
  35. libraryExport:'default',
  36. globalObject:'typeof self !== \'undefined\' ? self : this'
  37. }
  38. };
  39. module.exports = merge(prodConfig, webpackConfigBase);