No Description

webpack.base.conf.js 1.8KB

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