微小悟公众号管理系统

webpack.base.conf.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. var path = require('path')
  2. var utils = require('./utils')
  3. var config = require('../config')
  4. var vueLoaderConfig = require('./vue-loader.conf')
  5. var saladConf = require('./webpack.salad.conf.json')
  6. var postcssSalad = require('postcss-salad')
  7. function resolve(dir) {
  8. return path.join(__dirname, '..', dir)
  9. }
  10. const webpackConfig = {
  11. entry: {
  12. app: './src/main.js'
  13. },
  14. output: {
  15. path: config.build.assetsRoot,
  16. filename: '[name].js',
  17. publicPath: process.env.NODE_ENV === 'production'
  18. ? config.build.assetsPublicPath
  19. : config.dev.assetsPublicPath
  20. },
  21. resolve: {
  22. extensions: ['.js', '.vue', '.json'],
  23. alias: {
  24. '@': resolve('src'),
  25. 'vue$': 'vue/dist/vue.esm.js',
  26. }
  27. },
  28. module: {
  29. rules: [
  30. {
  31. // test: /\.(js|vue)$/,
  32. // loader: 'eslint-loader',
  33. // enforce: 'pre',
  34. // include: [resolve('src'), resolve('test')],
  35. // options: {
  36. // formatter: require('eslint-friendly-formatter')
  37. // }
  38. },
  39. {
  40. test: /\.vue$/,
  41. loader: 'vue-loader',
  42. options: vueLoaderConfig
  43. },
  44. {
  45. test: /\.js$/,
  46. loader: 'babel-loader',
  47. include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client'), resolve('node_modules/vue-ueditor/')]
  48. },
  49. {
  50. test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  51. loader: 'url-loader',
  52. options: {
  53. limit: 10000,
  54. name: utils.assetsPath('img/[name].[hash:7].[ext]')
  55. }
  56. },
  57. {
  58. test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
  59. loader: 'url-loader',
  60. options: {
  61. limit: 10000,
  62. name: utils.assetsPath('media/[name].[hash:7].[ext]')
  63. }
  64. },
  65. {
  66. test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  67. loader: 'url-loader',
  68. options: {
  69. limit: 10000,
  70. name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
  71. }
  72. }
  73. ]
  74. }
  75. }
  76. module.exports = webpackConfig