血透系统pad前端

webpack.base.conf.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. 'use strict'
  2. const path = require('path')
  3. const utils = require('./utils')
  4. const config = require('../config')
  5. const vueLoaderConfig = require('./vue-loader.conf')
  6. function resolve (dir) {
  7. return path.join(__dirname, '..', dir)
  8. }
  9. const createLintingRule = () => ({
  10. test: /\.(js|vue)$/,
  11. loader: 'eslint-loader',
  12. enforce: 'pre',
  13. include: [resolve('src'), resolve('test')],
  14. options: {
  15. formatter: require('eslint-friendly-formatter'),
  16. emitWarning: !config.dev.showEslintErrorsInOverlay
  17. }
  18. })
  19. let webpackConfig = {
  20. context: path.resolve(__dirname, '../'),
  21. entry: {
  22. app: './src/main.js'
  23. },
  24. output: {
  25. path: config.build.assetsRoot,
  26. filename: '[name].js',
  27. publicPath: process.env.NODE_ENV === 'production'
  28. ? config.build.assetsPublicPath
  29. : config.dev.assetsPublicPath
  30. },
  31. resolve: {
  32. extensions: ['.js', '.vue', '.json'],
  33. alias: {
  34. 'vue$': 'vue/dist/vue.esm.js',
  35. '@': resolve('src'),
  36. 'jquery':'jquery',
  37. }
  38. },
  39. module: {
  40. rules: [
  41. // ...(config.dev.useEslint ? [createLintingRule()] : []),
  42. {
  43. test: /\.vue$/,
  44. loader: 'vue-loader',
  45. options: vueLoaderConfig
  46. },
  47. {
  48. test: /\.js$/,
  49. loader: 'babel-loader',
  50. include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
  51. },
  52. {
  53. test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  54. loader: 'url-loader',
  55. options: {
  56. limit: 10000,
  57. name: utils.assetsPath('img/[name].[hash:7].[ext]')
  58. }
  59. },
  60. {
  61. test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
  62. loader: 'url-loader',
  63. options: {
  64. limit: 10000,
  65. name: utils.assetsPath('media/[name].[hash:7].[ext]')
  66. }
  67. },
  68. {
  69. test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  70. loader: 'url-loader',
  71. options: {
  72. limit: 10000,
  73. name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
  74. }
  75. },
  76. {
  77. test: /\.sass$/,
  78. loaders: ['style', 'css', 'sass']
  79. }
  80. ]
  81. },
  82. node: {
  83. // prevent webpack from injecting useless setImmediate polyfill because Vue
  84. // source contains it (although only uses it if it's native).
  85. setImmediate: false,
  86. // prevent webpack from injecting mocks to Node native modules
  87. // that does not make sense for the client
  88. dgram: 'empty',
  89. fs: 'empty',
  90. net: 'empty',
  91. tls: 'empty',
  92. child_process: 'empty'
  93. }
  94. }
  95. module.exports = webpackConfig
  96. // var vueLoaderConfig = require('./vue-loader.conf')
  97. const vuxLoader = require('vux-loader')
  98. // module.exports = vuxLoader.merge(webpackConfig, {
  99. // plugins: ['vux-ui']
  100. // })
  101. module.exports = vuxLoader.merge(webpackConfig, {
  102. plugins: [
  103. {
  104. name: 'vux-ui'
  105. },
  106. {
  107. name: 'duplicate-style'
  108. },
  109. {
  110. name: 'less-theme',
  111. path: 'src/styles/vux.less'
  112. }
  113. ]
  114. })