You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.5 KiB

8 years ago
  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. '@': resolve('src')
  23. }
  24. },
  25. module: {
  26. rules: [
  27. {
  28. test: /\.(js|vue)$/,
  29. loader: 'eslint-loader',
  30. enforce: 'pre',
  31. include: [resolve('src'), resolve('test')],
  32. options: {
  33. formatter: require('eslint-friendly-formatter')
  34. }
  35. },
  36. {
  37. test: /\.vue$/,
  38. loader: 'vue-loader',
  39. options: vueLoaderConfig
  40. },
  41. {
  42. test: /\.js$/,
  43. loader: 'babel-loader',
  44. include: [resolve('src'), resolve('test')]
  45. },
  46. {
  47. test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  48. loader: 'url-loader',
  49. options: {
  50. limit: 10000,
  51. name: utils.assetsPath('img/[name].[hash:7].[ext]')
  52. }
  53. },
  54. {
  55. test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  56. loader: 'url-loader',
  57. options: {
  58. limit: 10000,
  59. name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
  60. }
  61. }
  62. ]
  63. }
  64. }