同步完整版代码
增加颜色切换功能 Former-commit-id: 37d688a0ee4ebadbb1980f2509d722931099c82c
This commit is contained in:
+24
-3
@@ -1,5 +1,8 @@
|
||||
const VueFilenameInjector = require('@d2-projects/vue-filename-injector')
|
||||
|
||||
const ThemeColorReplacer = require('webpack-theme-color-replacer')
|
||||
const forElementUI = require('webpack-theme-color-replacer/forElementUI')
|
||||
|
||||
// 拼接路径
|
||||
const resolve = dir => require('path').join(__dirname, dir)
|
||||
|
||||
@@ -11,7 +14,8 @@ process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYY-M-D HH:mm:ss')
|
||||
let publicPath = '/'
|
||||
|
||||
module.exports = {
|
||||
publicPath, // 根据你的实际情况更改这里
|
||||
// 根据你的实际情况更改这里
|
||||
publicPath,
|
||||
lintOnSave: true,
|
||||
devServer: {
|
||||
publicPath // 和 publicPath 保持一致
|
||||
@@ -38,6 +42,16 @@ module.exports = {
|
||||
// 解决 cli3 热更新失效 https://github.com/vuejs/vue-cli/issues/1559
|
||||
config.resolve
|
||||
.symlinks(true)
|
||||
config
|
||||
.plugin('theme-color-replacer')
|
||||
.use(ThemeColorReplacer, [{
|
||||
fileName: 'css/theme-colors.[contenthash:8].css',
|
||||
matchColors: [
|
||||
...forElementUI.getElementUISeries(process.env.VUE_APP_ELEMENT_COLOR) // Element-ui主色系列
|
||||
],
|
||||
externalCssFiles: [ './node_modules/element-ui/lib/theme-chalk/index.css' ], // optional, String or string array. Set external css files (such as cdn css) to extract colors.
|
||||
changeSelector: forElementUI.changeSelector
|
||||
}])
|
||||
config
|
||||
// 开发环境
|
||||
.when(process.env.NODE_ENV === 'development',
|
||||
@@ -45,11 +59,18 @@ module.exports = {
|
||||
config => config.devtool('cheap-source-map')
|
||||
)
|
||||
// TRAVIS 构建 vue-loader 添加 filename
|
||||
.when(process.env.VUE_APP_BUILD_MODE === 'TRAVIS' || process.env.NODE_ENV === 'development',
|
||||
.when(process.env.VUE_APP_SCOURCE_LINK === 'TRUE',
|
||||
VueFilenameInjector(config, {
|
||||
propName: process.env.VUE_APP_SOURCE_VIEWER_PROP_NAME
|
||||
})
|
||||
)
|
||||
// markdown
|
||||
config.module
|
||||
.rule('md')
|
||||
.test(/\.md$/)
|
||||
.use('text-loader')
|
||||
.loader('text-loader')
|
||||
.end()
|
||||
// svg
|
||||
const svgRule = config.module.rule('svg')
|
||||
svgRule.uses.clear()
|
||||
@@ -75,7 +96,7 @@ module.exports = {
|
||||
.set('@api', resolve('src/api'))
|
||||
// 判断环境加入模拟数据
|
||||
const entry = config.entry('app')
|
||||
if (process.env.VUE_APP_BUILD_MODE !== 'nomock') {
|
||||
if (process.env.VUE_APP_BUILD_MODE !== 'NOMOCK') {
|
||||
entry
|
||||
.add('@/mock')
|
||||
.end()
|
||||
|
||||
Reference in New Issue
Block a user