mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-09-10 21:30:14 +08:00
* fixed[tagsView]: DEL_OTHERS_VIEWS cachedViews bug (#913) * mutations DEL_OTHERS_VIEWS state.cachedViews -> i type is string slice(begin: number, end: number) * fix[Tinymce]: fixed tinymce upload dialog bug #654 * [release] 3.7.3 * docs: add gitee * perf[login.vue]: Improve input background and cursor color (#927) * 完善input背景和光标色; 1.完善在Chrome浏览器时登陆界面的input标签 使用记住密码之后颜色和背景不一致; 2.目前的rgb值是 #2d3a4b 修改的rgb值是 #283443; 3.修复光标使用Chrome记录的账号之后变黑色; 4.移除 .title-container .title 重复的font-weight: 400; 5.不用IE我们大家都是好朋友!~ * Update index.vue * docs: tweak * tweak * fix: demo links * fixBug[waves.js]: wave's position (#949) * fixBug[waves.js]-wave's position * fix[waves.js]-wave's position * fix typo(#965) * update to webpack4 (#889) * [release] 3.8.0 * Update README.zh-CN.md * format code * docs: change vueAdmin-template => vue-admin-template
97 lines
2.7 KiB
JavaScript
97 lines
2.7 KiB
JavaScript
'use strict'
|
|
const path = require('path')
|
|
const utils = require('./utils')
|
|
const webpack = require('webpack')
|
|
const config = require('../config')
|
|
const merge = require('webpack-merge')
|
|
const baseWebpackConfig = require('./webpack.base.conf')
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
|
const portfinder = require('portfinder')
|
|
|
|
function resolve(dir) {
|
|
return path.join(__dirname, '..', dir)
|
|
}
|
|
|
|
const HOST = process.env.HOST
|
|
const PORT = process.env.PORT && Number(process.env.PORT)
|
|
|
|
const devWebpackConfig = merge(baseWebpackConfig, {
|
|
mode: 'development',
|
|
module: {
|
|
rules: utils.styleLoaders({
|
|
sourceMap: config.dev.cssSourceMap,
|
|
usePostCSS: true
|
|
})
|
|
},
|
|
// cheap-module-eval-source-map is faster for development
|
|
devtool: config.dev.devtool,
|
|
|
|
// these devServer options should be customized in /config/index.js
|
|
devServer: {
|
|
clientLogLevel: 'warning',
|
|
historyApiFallback: true,
|
|
hot: true,
|
|
compress: true,
|
|
host: HOST || config.dev.host,
|
|
port: PORT || config.dev.port,
|
|
open: config.dev.autoOpenBrowser,
|
|
overlay: config.dev.errorOverlay
|
|
? { warnings: false, errors: true }
|
|
: false,
|
|
publicPath: config.dev.assetsPublicPath,
|
|
proxy: config.dev.proxyTable,
|
|
quiet: true, // necessary for FriendlyErrorsPlugin
|
|
watchOptions: {
|
|
poll: config.dev.poll
|
|
}
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
'process.env': require('../config/dev.env')
|
|
}),
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
// https://github.com/ampedandwired/html-webpack-plugin
|
|
new HtmlWebpackPlugin({
|
|
filename: 'index.html',
|
|
template: 'index.html',
|
|
inject: true,
|
|
favicon: resolve('favicon.ico'),
|
|
title: 'vue-element-admin',
|
|
path: config.dev.assetsPublicPath + config.dev.assetsSubDirectory
|
|
})
|
|
]
|
|
})
|
|
|
|
module.exports = new Promise((resolve, reject) => {
|
|
portfinder.basePort = process.env.PORT || config.dev.port
|
|
portfinder.getPort((err, port) => {
|
|
if (err) {
|
|
reject(err)
|
|
} else {
|
|
// publish the new Port, necessary for e2e tests
|
|
process.env.PORT = port
|
|
// add port to devServer config
|
|
devWebpackConfig.devServer.port = port
|
|
|
|
// Add FriendlyErrorsPlugin
|
|
devWebpackConfig.plugins.push(
|
|
new FriendlyErrorsPlugin({
|
|
compilationSuccessInfo: {
|
|
messages: [
|
|
`Your application is running here: http://${
|
|
devWebpackConfig.devServer.host
|
|
}:${port}`
|
|
]
|
|
},
|
|
onErrors: config.dev.notifyOnErrors
|
|
? utils.createNotifierCallback()
|
|
: undefined
|
|
})
|
|
)
|
|
|
|
resolve(devWebpackConfig)
|
|
}
|
|
})
|
|
})
|