我自己的代码大约是900 kb。 我的css大约是137 kb。 我有3个捆绑。
vendor-bundle.js包含在/assets/libs/index.js中,并且最多可添加10Mb。每次包括后我都有尺寸。语义怎么能是6Mb ???我做错了什么?
window.React = require('react'); (3 Mb)
require('jquery'); (1.7 Mb)
require('underscore'); (138 kb)
require('fastclick'); (72 kb)
require('semantic'); (6.7 Mb)
require('./markerclusterer'); (116 kb)
require('./stickyfill.min'); (30 kb)
app-bundle和account-bundle大小相同,每个大约11Mb。为主站点的登录/注册页面和应用程序包加载帐户包。我自己的代码只有970 kb;捆绑包怎么能加起来11MB ???
module.exports = {
sass: {
base_file: src + "/assets/css/main.scss",
src: src + "/assets/css/**/*.{sass,scss}",
dest: dest + "/css",
dest2: dest2 + "/css",
settings: {
indentedSyntax: true,
imagePath: 'images'
}
},
images: {
src: src + "/assets/images/**",
dest: dest + "/images",
dest2: dest2 + "/images"
},
fonts: {
src: src + '/assets/fonts/**',
dest: dest + '/fonts',
dest2: dest2 + "/fonts"
},
js: {
src: src + '/app/**/*.js',
dest: dest + 'js'
},
browserify: { // A separate bundle will be generated for each bundle config in this list
bundleConfigs: [{
entries: src + '/assets/libs/index.js',
dest: dest + '/js',
dest2: dest2 + '/js',
mapName: 'vendor.map.json',
outputName: 'vendor-bundle.js',
require: [ 'jquery', 'underscore' , 'fastclick' , 'semantic' ]
},{
entries: src + '/app/app.account.js',
dest: dest + '/js',
dest2: dest2 + '/js',
mapName: 'account.map,json',
outputName: 'account-bundle.js',
//list of externally available modules to exclude from the bundle
external: [ 'jquery', 'underscore', 'lodash' , 'fastclick' , 'semantic' , '/app/app.main.js']
},{
entries: src + '/app/app.main.js',
dest: dest + '/js',
dest2: dest2 + '/js',
mapName: 'app.map,json',
outputName: 'app-bundle.js',
//list of externally available modules to exclude from the bundle
external: [ 'jquery', 'underscore', 'lodash', 'fastclick' , 'semantic' ]
}]
},
production: {
cssSrc: dest + '/css/*.css',
jsSrc: dest + '/js/*.js',
dest: dest
}
};
另外,一旦我学会了如何剥离捆绑包,我最容易压缩它们并删除所有注释?
我花了很多时间在线研究,但我已经没时间了。 谢谢