Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion template/client/app/router/routerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default [
name:'start',
url:"/start",
template:'<start class="routename"></start>',
lazyload:require("bundle?lazy&name=start!../components/start/start.js"),
lazyload:require("bundle-loader?lazy&name=start!../components/start/start.js"),
tracking:{
key:'start'
}
Expand Down
1 change: 1 addition & 0 deletions template/client/index.html → template/client/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<!--<base href="/">-->
</head>
<body ng-app="app" ng-strict-di ng-cloak>
<%= htmlWebpackPlugin.files.webpackManifest %>
<app>
</app>
</body>
Expand Down
7 changes: 5 additions & 2 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"bundle-loader": "^0.5.4",
"browser-sync": "^2.11.1",
"chai": "^3.4.0",
"chunk-manifest-webpack-plugin": "^1.1.0",
"connect-history-api-fallback": "^1.1.0",
"css-loader": "^0.19.0",
"file-loader": "^0.8.5",
Expand All @@ -29,7 +30,7 @@
"gulp-rename": "^1.2.2",
"gulp-template": "^3.0.0",
"gulp-util": "^3.0.7",
"html-webpack-plugin": "^1.7.0",
"html-webpack-plugin": "^2.28.0",
"karma": "^0.13.9",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.2.0",
Expand All @@ -46,14 +47,16 @@
"run-sequence": "^1.1.0",
"style-loader": "^0.12.2",
"supports-color": "^3.1.2",
"webpack": "^1.9.5",
"webpack": "^2.6.1",
"webpack-dev-middleware": "^1.4.0",
"webpack-hot-middleware": "^2.6.0",
"webpack-dev-server": "^1.15.1",
"yargs": "^3.9.0",
"is-utf8": "^0.2.0",
"http-proxy-middleware": "^0.13.0",
"happypack": "^4.0.0-beta.1",
"webpack-manifest-plugin": "^1.1.0",
"webpack-md5-hash": "^0.0.5",
"webpack-parallel-uglify-plugin": "^0.4.1"
},
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions template/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ module.exports = {
new HappyPack({
id: 'img',
threads: os.cpus().length,
loaders: ['file?name=assets/img/img-[hash].[ext]']
loaders: ['file-loader?name=assets/img/img-[chunkhash].[ext]']
}),
new HappyPack({
id: 'html',
threads: os.cpus().length,
loaders: ['raw']
loaders: ['raw-loader']
}),
new HappyPack({
id: 'font',
Expand All @@ -108,7 +108,7 @@ module.exports = {
// It also adds hash to all injected assets so we don't have problems
// with cache purging during deployment.
new HtmlWebpackPlugin({
template: 'client/index.html',
template: 'client/index.ejs',
inject: 'body',
hash: true
}),
Expand All @@ -119,7 +119,7 @@ module.exports = {
}),

new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
name: ['vendor','manifest'],
minChunks: function (module, count) {
return module.resource && module.resource.indexOf(path.resolve(__dirname, 'client')) === -1;
}
Expand Down
15 changes: 13 additions & 2 deletions template/webpack.dist.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ var customConfig = require('./custom.env.config');

var os = require('os');
var ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
var ManifestPlugin = require('webpack-manifest-plugin');
var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
var WebpackMd5Hash = require('webpack-md5-hash');

var distPath = customConfig.distPath;

config.output = {
filename: '[name].bundle.js',
chunkFilename:'[name].min.js',
filename: '[name].[chunkhash].bundle.js',
chunkFilename:'[name].[chunkhash].min.js',
publicPath: '',
path: distPath
};
Expand Down Expand Up @@ -41,6 +44,14 @@ config.plugins = config.plugins.concat([
'NODE_ENV': JSON.stringify('sit'),
'DEBUG': false
}
}),
//引入manifest
new WebpackMd5Hash(),
new ManifestPlugin(),
new ChunkManifestPlugin({
filename: "chunk-manifest.json",
manifestVariable: "webpackManifest",
inlineManifest: true
})
]);

Expand Down