Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

94 lines
2.3KB

  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. module.exports = {
  10. context: path.resolve(__dirname, '../'),
  11. entry: {
  12. app: ["babel-polyfill", "./src/main.js"]
  13. },
  14. externals: {
  15. 'AMap': 'AMap',
  16. },
  17. output: {
  18. path: config.build.assetsRoot,
  19. filename: '[name].js',
  20. publicPath: process.env.NODE_ENV === 'production'
  21. ? config.build.assetsPublicPath
  22. : config.dev.assetsPublicPath
  23. },
  24. resolve: {
  25. extensions: ['.js', '.vue', '.json'],
  26. alias: {
  27. '@': resolve('src'),
  28. 'static':path.resolve(__dirname, '../static'),
  29. }
  30. },
  31. module: {
  32. rules: [
  33. {
  34. test: /\.vue$/,
  35. loader: 'vue-loader',
  36. options: vueLoaderConfig
  37. },
  38. {
  39. test: /\.js$/,
  40. loader: 'babel-loader',
  41. include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
  42. },
  43. {
  44. test: /\.svg$/,
  45. loader: 'svg-sprite-loader',
  46. include: [resolve('src/assets/icons')],
  47. options: {
  48. symbolId: 'icon-[name]'
  49. }
  50. },
  51. {
  52. test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  53. loader: 'url-loader',
  54. exclude: [resolve('src/assets/icons')],
  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. },
  78. node: {
  79. // prevent webpack from injecting useless setImmediate polyfill because Vue
  80. // source contains it (although only uses it if it's native).
  81. setImmediate: false,
  82. // prevent webpack from injecting mocks to Node native modules
  83. // that does not make sense for the client
  84. dgram: 'empty',
  85. fs: 'empty',
  86. net: 'empty',
  87. tls: 'empty',
  88. child_process: 'empty'
  89. }
  90. }