Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
shijian
8 years ago
Commit
550c067d8c5d414d7e7fa8a2b7430864411df3aa
1 parent
ec5c6c61
web pack性能提优
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
11 deletions
.gitignore
package.json
public/build/webpack.base.config.js
public/build/webpack.dev.config.js
.gitignore
View file @
550c067
...
...
@@ -146,3 +146,4 @@ public/bundle/*
nbproject/*
.DS_Store
.devhost
.happypack/
\ No newline at end of file
...
...
package.json
View file @
550c067
...
...
@@ -31,6 +31,7 @@
"express"
:
"^4.14.0"
,
"express-session"
:
"^1.14.1"
,
"handlebars-loader"
:
"^1.5.0"
,
"happypack"
:
"^3.1.0"
,
"influxdb-winston"
:
"^1.0.1"
,
"lodash"
:
"^4.15.0"
,
"memcached"
:
"^2.2.1"
,
...
...
@@ -46,6 +47,7 @@
"vue-loader"
:
"^8.3.0"
,
"vue-template-compiler"
:
"^2.3.3"
,
"webpack-uglify-parallel"
:
"^0.1.3"
,
"webpack-visualizer-plugin"
:
"^0.1.11"
,
"winston"
:
"^2.2.0"
,
"winston-daily-rotate-file"
:
"^1.3.0"
,
"yoho-jquery"
:
"^2.2.4"
,
...
...
public/build/webpack.base.config.js
View file @
550c067
...
...
@@ -3,6 +3,24 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
const
webpack
=
require
(
'webpack'
);
const
shelljs
=
require
(
'shelljs'
);
const
_
=
require
(
'lodash'
);
const
HappyPack
=
require
(
'happypack'
);
const
os
=
require
(
'os'
);
const
happyThreadPool
=
HappyPack
.
ThreadPool
({
// eslint-disable-line
size
:
os
.
cpus
().
length
});
const
hbsLoader
=
{
loader
:
'handlebars-loader'
,
options
:
{
helperDirs
:
[
path
.
join
(
__dirname
,
'../js/common/helpers'
)
],
partialDirs
:
[
path
.
join
(
__dirname
,
'../../doraemon/views/partial'
)
]
}
};
const
getEntries
=
()
=>
{
const
entries
=
{
...
...
@@ -59,7 +77,7 @@ module.exports = {
test
:
/
\.
js$/
,
exclude
:
/
(
node_modules|bower_components
)
/
,
use
:
{
loader
:
'
babel-loader
'
loader
:
'
happypack/loader?id=js
'
}
},
{
test
:
/
\.
css$/
,
...
...
@@ -76,19 +94,21 @@ module.exports = {
},
{
test
:
/
\.
hbs$/
,
use
:
[{
loader
:
'handlebars-loader'
,
options
:
{
helperDirs
:
[
path
.
join
(
__dirname
,
'../js/common/helpers'
)
],
partialDirs
:
[
path
.
join
(
__dirname
,
'../../doraemon/views/partial'
)
]
}
loader
:
'happypack/loader?id=hbs'
}]
}]
},
plugins
:
[
new
HappyPack
({
id
:
'js'
,
threadPool
:
happyThreadPool
,
loaders
:
[
'babel-loader'
],
}),
new
HappyPack
({
id
:
'hbs'
,
threadPool
:
happyThreadPool
,
loaders
:
[
hbsLoader
]
}),
new
ExtractTextPlugin
(
'[name].css'
),
new
webpack
.
optimize
.
CommonsChunkPlugin
({
names
:
'libs'
...
...
public/build/webpack.dev.config.js
View file @
550c067
...
...
@@ -2,6 +2,7 @@ const merge = require('webpack-merge');
const
webpack
=
require
(
'webpack'
);
const
path
=
require
(
'path'
);
const
devInfo
=
require
(
'./dev-info.js'
);
var
Visualizer
=
require
(
'webpack-visualizer-plugin'
);
module
.
exports
=
merge
(
require
(
'./webpack.base.config'
),
{
...
...
@@ -10,7 +11,10 @@ module.exports = merge(require('./webpack.base.config'), {
path
:
path
.
resolve
(
__dirname
,
'bundle'
)
},
plugins
:
[
new
webpack
.
HotModuleReplacementPlugin
()
new
webpack
.
HotModuleReplacementPlugin
(),
new
Visualizer
({
filename
:
'./statistics.html'
})
],
devServer
:
{
contentBase
:
[
path
.
join
(
__dirname
,
'../'
)],
...
...
Please
register
or
login
to post a comment