webpack.dev.conf.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict'
  2. const utils = require('./utils')
  3. const webpack = require('webpack')
  4. const config = require('../config')
  5. const merge = require('webpack-merge')
  6. const baseWebpackConfig = require('./webpack.base.conf')
  7. const HtmlWebpackPlugin = require('html-webpack-plugin')
  8. const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
  9. //var baseOption = {"project":"kaide", "fileServer": "https://resi-service-uat.capitaland.com.cn"}; // 凯德
  10. var baseOption = {"project":"ebei", "fileServer": "http://cms.wuyeface.com"}; //云环境
  11. //var baseOption = {"project":"lvdu", "fileServer": "http://wy.zzldgc.cn"}; // 绿都
  12. //var baseOption = {"project":"zhongtongfu", "fileServer": "http://huiyuntest.wuyeface.com"}; //中通服测试
  13. // add hot-reload related code to entry chunks
  14. Object.keys(baseWebpackConfig(baseOption).entry).forEach(function (name) {
  15. baseWebpackConfig(baseOption).entry[name] = ['./build/dev-client'].concat(baseWebpackConfig(baseOption).entry[name])
  16. })
  17. module.exports = merge(baseWebpackConfig(baseOption), {
  18. module: {
  19. rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap,project:baseOption.project })
  20. },
  21. // cheap-module-eval-source-map is faster for development
  22. devtool: '#cheap-module-eval-source-map',
  23. plugins: [
  24. new webpack.DefinePlugin({
  25. 'process.env': config.dev.env,
  26. 'host.PROJECT':JSON.stringify(baseOption.project),
  27. 'host.FILE_SERVER':JSON.stringify(baseOption.fileServer),
  28. 'host.LOGINPATH': JSON.stringify('') //统一登录路径
  29. }),
  30. // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
  31. new webpack.HotModuleReplacementPlugin(),
  32. new webpack.NoEmitOnErrorsPlugin(),
  33. // https://github.com/ampedandwired/html-webpack-plugin
  34. new HtmlWebpackPlugin({
  35. filename: 'index.html',
  36. template: 'index.html',
  37. inject: true
  38. }),
  39. new FriendlyErrorsPlugin()
  40. ]
  41. })