跳板机管理web端
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.

77 lines
2.0 KiB

8 years ago
  1. var path = require('path')
  2. var config = require('../config')
  3. var utils = require('./utils')
  4. var projectRoot = path.resolve(__dirname, '../')
  5. var env = process.env.NODE_ENV
  6. // check env & config/index.js to decide weither to enable CSS Sourcemaps for the
  7. // various preprocessor loaders added to vue-loader at the end of this file
  8. var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
  9. var cssSourceMapProd = (env === 'production' && config.build.productionSourceMap)
  10. var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
  11. module.exports = {
  12. entry: {
  13. app: './src/main.js'
  14. },
  15. output: {
  16. path: config.build.assetsRoot,
  17. publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
  18. filename: '[name].js'
  19. },
  20. resolve: {
  21. extensions: ['', '.js', '.vue'],
  22. fallback: [path.join(__dirname, '../node_modules')],
  23. alias: {
  24. 'vue$': 'vue/dist/vue',
  25. 'src': path.resolve(__dirname, '../src'),
  26. 'assets': path.resolve(__dirname, '../src/assets'),
  27. 'components': path.resolve(__dirname, '../src/components')
  28. }
  29. },
  30. resolveLoader: {
  31. fallback: [path.join(__dirname, '../node_modules')]
  32. },
  33. module: {
  34. loaders: [
  35. {
  36. test: /\.vue$/,
  37. loader: 'vue'
  38. },
  39. {
  40. test: /\.js$/,
  41. loader: 'babel',
  42. include: projectRoot,
  43. exclude: /node_modules/
  44. },
  45. {
  46. test: /\.json$/,
  47. loader: 'json'
  48. },
  49. {
  50. test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  51. loader: 'url',
  52. query: {
  53. limit: 10000,
  54. name: utils.assetsPath('img/[name].[hash:7].[ext]')
  55. }
  56. },
  57. {
  58. test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  59. loader: 'url',
  60. query: {
  61. limit: 10000,
  62. name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
  63. }
  64. }
  65. ]
  66. },
  67. vue: {
  68. loaders: utils.cssLoaders({ sourceMap: useCssSourceMap }),
  69. postcss: [
  70. require('autoprefixer')({
  71. browsers: ['last 2 versions']
  72. })
  73. ]
  74. }
  75. }