Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-base
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张冬
web-base
Commits
214d6a9b
Commit
214d6a9b
authored
Sep 10, 2020
by
张冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2
parent
737367eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
3 deletions
+114
-3
vue.config.js
vue.config.js
+3
-3
vue.config.js.bak
vue.config.js.bak
+111
-0
No files found.
vue.config.js
View file @
214d6a9b
...
@@ -46,7 +46,7 @@ module.exports = {
...
@@ -46,7 +46,7 @@ module.exports = {
}),
}),
new
InsertScriptPlugin
({
files
:
modules
})
new
InsertScriptPlugin
({
files
:
modules
})
]
]
const
webpackAliyunOss
=
[
<!--
const
webpackAliyunOss
=
[
new
WebpackAliyunOss
({
new
WebpackAliyunOss
({
// from: './dist/**', // 上传那个文件或文件夹 可以是字符串或数组
// from: './dist/**', // 上传那个文件或文件夹 可以是字符串或数组
// dist: 'web_admin/', // 需要上传到oss上的给定文件目录
// dist: 'web_admin/', // 需要上传到oss上的给定文件目录
...
@@ -57,7 +57,7 @@ module.exports = {
...
@@ -57,7 +57,7 @@ module.exports = {
// some operations to filePath
// some operations to filePath
const
index
=
filePath
.
lastIndexOf
(
'dist'
)
const
index
=
filePath
.
lastIndexOf
(
'dist'
)
const
Path
=
filePath
.
substring
(
index
+
4
,
filePath
.
length
)
const
Path
=
filePath
.
substring
(
index
+
4
,
filePath
.
length
)
return
Path
.
replace
(
/
\
\
/g
,
'/'
)
return
Path
.
replace
(
/
\/
g, '/
')
},
},
setHeaders: (filePath) => {
setHeaders: (filePath) => {
// some operations to filePath
// some operations to filePath
...
@@ -67,7 +67,7 @@ module.exports = {
...
@@ -67,7 +67,7 @@ module.exports = {
}
}
}
}
})
})
]
]
-->
if (NODE_ENV === '
production
') {
if (NODE_ENV === '
production
') {
config.plugins = [...webpackAliyunOss, ...config.plugins]
config.plugins = [...webpackAliyunOss, ...config.plugins]
...
...
vue.config.js.bak
0 → 100644
View file @
214d6a9b
const webpack = require('webpack')
const InsertScriptPlugin = require('./scripts/InsertScriptWebpackPlugin')
const APP_NAME = require('./package.json').name
const PORT = require('./package.json').devPort
const path = require('path')
const WebpackAliyunOss = require('webpack-aliyun-oss')
const STATICDOMAIN = process.env.VUE_APP_STATICCDOMAIN || ''
const PROXY = require('./RPOXY')
//
const modules = [
'./web_admin/web_user/main.js',
// './web_admin/web_all/main.js'
]
// const productionModules = [
// ''
// ]
// log('PROXY', PROXY)
function resolve(dir) {
return path.join(__dirname, './' + dir)
}
const NODE_ENV = process.env.NODE_ENV || 'development'
log('APP_NAME: ', APP_NAME)
log('NODE_ENV: ', NODE_ENV)
log('publicPath', `${NODE_ENV === 'development' ? './' : STATICDOMAIN + '/'}`)
module.exports = {
// publicPath: './',
publicPath: `${NODE_ENV === 'development' ? './' : STATICDOMAIN + '/'}`,
productionSourceMap: false,
configureWebpack: () => {
const config = {}
config.externals = {
vue: 'Vue'
}
config.plugins = [
new webpack.DefinePlugin({
'process.env.VUE_APP_NAME': JSON.stringify(APP_NAME)
}),
new InsertScriptPlugin({ files: modules })
]
const webpackAliyunOss = [
new WebpackAliyunOss({
// from: './dist/**', // 上传那个文件或文件夹 可以是字符串或数组
// dist: 'web_admin/', // 需要上传到oss上的给定文件目录
// region: 'oss-cn-shenzhen',
// bucket: 'ppy-prod-webadmin',
// test: true,
setOssPath: (filePath) => {
// some operations to filePath
const index = filePath.lastIndexOf('dist')
const Path = filePath.substring(index + 4, filePath.length)
return Path.replace(/\\/g, '/')
},
setHeaders: (filePath) => {
// some operations to filePath
// return false to use default header
return {
'Cache-Control': 'max-age=31536000'
}
}
})
]
if (NODE_ENV === 'production') {
config.plugins = [...webpackAliyunOss, ...config.plugins]
}
return config
},
chainWebpack: (config) => {
config.resolve.alias
.set('@components', resolve('src/components'))
.set('@lib', resolve('src/lib'))
.set('@styles', resolve('src/styles'))
.set('@assets', resolve('src/assets'))
.set('@enum', resolve('src/enum'))
},
css: {
// 是否使用css分离插件 ExtractTextPlugin
extract: true,
// 开启 CSS source maps?
sourceMap: false,
// css预设器配置项
loaderOptions: {
sass: {
// @/ is an alias to src/
// so this assumes you have a file named `src/variables.scss`
}
},
// 启用 CSS modules for all css / pre-processor files.
modules: false
},
devServer: {
port: PORT,
proxy: PROXY
}
}
function log(label, content, options) {
console.log('\x1b[1m%s\x1b[31m%s\x1b[0m', label, content)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment