webpack.base.config.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. const webpack = require('webpack');
  2. const path = require('path');
  3. const VueLoaderPlugin = require('vue-loader/lib/plugin');
  4. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  5. module.exports = {
  6. entry: {
  7. main : "./main.js",
  8. // vendors: ['jquery', 'rem', 'vue'],
  9. },
  10. output: {
  11. },
  12. resolve: {
  13. extensions: ['.js', '.vue', '.scss'],
  14. alias: {
  15. "@": path.resolve(__dirname),
  16. "vue": 'vue/dist/vue.esm.js',
  17. "rem": path.resolve(__dirname, './depend/rem/rem.js'),
  18. "form": path.resolve(__dirname, './depend/form/form.js'),
  19. "md5": path.resolve(__dirname, './depend/md5/md5.js'),
  20. "cookie": path.resolve(__dirname, './depend/cookie/cookie.js'),
  21. "store": path.resolve(__dirname, './depend/store/store.js'),
  22. "lib": path.resolve(__dirname, './depend/lib/lib.js'),
  23. "extSdk": path.resolve(__dirname, './depend/extSdk/extSdk.js'),
  24. "config": path.resolve(__dirname, './depend/config/config.js'),
  25. "pay": path.resolve(__dirname, './depend/pay/pay.js'),
  26. }
  27. },
  28. module: {
  29. rules: [{
  30. test: /\.js$/,
  31. exclude: /(node_modules|bower_components)/,
  32. use: {
  33. loader : 'babel-loader',
  34. options : {
  35. presets : ['es2015']
  36. }
  37. }
  38. },{
  39. test: /\.vue$/,
  40. loader: 'vue-loader'
  41. },{
  42. test: /\.scss$/,
  43. use: [
  44. 'vue-style-loader',
  45. 'css-loader',
  46. 'sass-loader'
  47. ]
  48. },{
  49. test: /\.(png|jpg|gif)$/i,
  50. use: [
  51. {
  52. loader: 'url-loader',
  53. options: {
  54. limit: 8192,
  55. outputPath: 'img/'
  56. }
  57. }
  58. ]
  59. },{
  60. test: /\.(html|tpl)$/,
  61. use: 'html-loader'
  62. },{
  63. test: /\.json$/,
  64. use: 'json-loader'
  65. }]
  66. },
  67. // babel: {
  68. // presets: ['es2015']
  69. // },
  70. plugins: [
  71. // new BundleAnalyzerPlugin(),
  72. new VueLoaderPlugin(),
  73. new webpack.optimize.ModuleConcatenationPlugin(),
  74. new webpack.HotModuleReplacementPlugin(),
  75. new webpack.LoaderOptionsPlugin({
  76. minimize: true
  77. }),
  78. new webpack.ProvidePlugin({
  79. $: "jquery",
  80. jQuery: "jquery",
  81. "window.jQuery": "jquery"
  82. })
  83. ]
  84. };