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

78 lines
2.1 KiB

8 years ago
8 years ago
8 years ago
8 years ago
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', '.scss'],
  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. 'scss_vars': path.resolve(__dirname, '../src/styles/vars.scss')
  29. }
  30. },
  31. resolveLoader: {
  32. fallback: [path.join(__dirname, '../node_modules')]
  33. },
  34. module: {
  35. loaders: [
  36. {
  37. test: /\.vue$/,
  38. loader: 'vue'
  39. },
  40. {
  41. test: /\.js$/,
  42. loader: 'babel',
  43. include: projectRoot,
  44. exclude: /node_modules/
  45. },
  46. {
  47. test: /\.json$/,
  48. loader: 'json'
  49. },
  50. {
  51. test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  52. loader: 'url',
  53. query: {
  54. limit: 10000,
  55. name: utils.assetsPath('img/[name].[hash:7].[ext]')
  56. }
  57. },
  58. {
  59. test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  60. loader: 'url',
  61. query: {
  62. limit: 10000,
  63. name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
  64. }
  65. }
  66. ]
  67. },
  68. vue: {
  69. loaders: utils.cssLoaders({ sourceMap: useCssSourceMap }),
  70. postcss: [
  71. require('autoprefixer')({
  72. browsers: ['last 2 versions']
  73. })
  74. ]
  75. }
  76. }