Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform-ui
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform-ui
Commits
31cfda86
Commit
31cfda86
authored
May 11, 2019
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改缓存bug
parent
4d3f3d9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
1 deletion
+124
-1
webpack.sit.conf.js
build/webpack.sit.conf.js
+123
-0
sit.env.js
config/sit.env.js
+1
-1
No files found.
build/webpack.sit.conf.js
0 → 100644
View file @
31cfda86
var
path
=
require
(
'path'
)
var
utils
=
require
(
'./utils'
)
var
webpack
=
require
(
'webpack'
)
var
config
=
require
(
'../config'
)
var
merge
=
require
(
'webpack-merge'
)
var
baseWebpackConfig
=
require
(
'./webpack.base.conf'
)
var
CopyWebpackPlugin
=
require
(
'copy-webpack-plugin'
)
var
HtmlWebpackPlugin
=
require
(
'html-webpack-plugin'
)
var
ExtractTextPlugin
=
require
(
'extract-text-webpack-plugin'
)
var
OptimizeCSSPlugin
=
require
(
'optimize-css-assets-webpack-plugin'
)
var
env
=
process
.
env
.
NODE_ENV
===
'sit'
?
config
.
build
.
sitEnv
:
config
.
build
.
prodEnv
;
// config.assetsPublicPath = (env.assetsPublicPath === undefined) ? config.assetsPublicPath : env.assetsPublicPath;
function
resolveApp
(
relativePath
)
{
return
path
.
resolve
(
relativePath
);
}
var
webpackConfig
=
merge
(
baseWebpackConfig
,
{
module
:
{
rules
:
utils
.
styleLoaders
({
sourceMap
:
config
.
build
.
productionSourceMap
,
extract
:
true
})
},
devtool
:
config
.
build
.
productionSourceMap
?
'#source-map'
:
false
,
output
:
{
path
:
config
.
build
.
assetsRoot
,
filename
:
utils
.
assetsPath
(
'js/[name].[chunkhash].js'
),
chunkFilename
:
utils
.
assetsPath
(
'js/[id].[chunkhash].js'
),
publicPath
:
config
.
build
.
assetsPublicPath
},
plugins
:
[
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new
webpack
.
DefinePlugin
({
'process.env'
:
env
}),
new
webpack
.
optimize
.
UglifyJsPlugin
({
compress
:
{
warnings
:
false
},
sourceMap
:
true
}),
// extract css into its own file
new
ExtractTextPlugin
({
filename
:
utils
.
assetsPath
(
'css/[name].[contenthash].css'
)
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new
OptimizeCSSPlugin
(),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new
HtmlWebpackPlugin
({
filename
:
'index.html'
,
template
:
'index.html'
,
inject
:
true
,
favicon
:
resolveApp
(
'favicon.ico'
),
minify
:
{
removeComments
:
true
,
collapseWhitespace
:
true
,
removeRedundantAttributes
:
true
,
useShortDoctype
:
true
,
removeEmptyAttributes
:
true
,
removeStyleLinkTypeAttributes
:
true
,
keepClosingSlash
:
true
,
minifyJS
:
true
,
minifyCSS
:
true
,
minifyURLs
:
true
},
path
:
config
.
build
.
assetsPublicPath
+
config
.
build
.
assetsSubDirectory
,
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode
:
'dependency'
}),
// cache Module Identifiers
new
webpack
.
HashedModuleIdsPlugin
(),
// split vendor js into its own file
new
webpack
.
optimize
.
CommonsChunkPlugin
({
name
:
'vendor'
,
minChunks
:
function
(
module
,
count
)
{
// any required modules inside node_modules are extracted to vendor
return
(
module
.
resource
&&
/
\.
js$/
.
test
(
module
.
resource
)
&&
module
.
resource
.
indexOf
(
path
.
join
(
__dirname
,
'../node_modules'
)
)
===
0
)
}
}),
// split echarts into its own file
new
webpack
.
optimize
.
CommonsChunkPlugin
({
async
:
'echarts'
,
minChunks
(
module
)
{
var
context
=
module
.
context
;
return
context
&&
(
context
.
indexOf
(
'echarts'
)
>=
0
||
context
.
indexOf
(
'zrender'
)
>=
0
);
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new
webpack
.
optimize
.
CommonsChunkPlugin
({
name
:
'manifest'
,
chunks
:
[
'vendor'
]
}),
// copy custom static assets
new
CopyWebpackPlugin
([{
from
:
path
.
resolve
(
__dirname
,
'../static'
),
to
:
config
.
build
.
assetsSubDirectory
,
ignore
:
[
'.*'
]
}]),
new
webpack
.
ProvidePlugin
({
$
:
'jquery'
,
'jQuery'
:
'jquery'
})
]
})
if
(
config
.
build
.
bundleAnalyzerReport
)
{
var
BundleAnalyzerPlugin
=
require
(
'webpack-bundle-analyzer'
).
BundleAnalyzerPlugin
webpackConfig
.
plugins
.
push
(
new
BundleAnalyzerPlugin
())
}
module
.
exports
=
webpackConfig
config/sit.env.js
View file @
31cfda86
module
.
exports
=
{
NODE_ENV
:
'"production"'
,
BASE_API
:
'"https://
api-si
t"'
,
BASE_API
:
'"https://
xxfcim.upyuns.com/cloudtes
t"'
,
APP_ORIGIN
:
'"https://wallstreetcn.com"'
};
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