Authored by ccbikai

libs 独立

This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -200,15 +200,20 @@ gulp.task('webpack-dev-server', () => {
});
// webpack compile in pro
gulp.task('webpack', () => {
gulp.task('webpack', (done) => {
var proConfig = Object.assign({}, webpackConfig);
proConfig.output.path = dist.js;
proConfig.plugins = [new webpack.optimize.UglifyJsPlugin()];
proConfig.plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}));
webpack(proConfig, (err, stats) => {
if (err) {
throw new gutil.PluginError('webpack', err);
}
gutil.log('[webpack compile]:', stats.endTime - stats.startTime, 'ms');
done();
});
});
... ...
... ... @@ -6,7 +6,7 @@
'use strict';
// const webpack = require('webpack');
const webpack = require('webpack');
const path = require('path');
const _ = require('lodash');
... ... @@ -21,6 +21,7 @@ shelljs.ls(path.join(__dirname, 'js/**/*.page.js')).forEach((f) => {
// Important
// 生成规则:module.page: './js/module/xx.page.js'
entries[`${dir[0]}.${dir[1].match(/(.*).page.js/)[1]}`] = `./js/${dir.join('/')}`;
entries.libs = ['yoho-jquery'];
});
module.exports = {
... ... @@ -28,5 +29,12 @@ module.exports = {
output: {
path: path.join(__dirname, 'bundle'), // absolute path
filename: '[name].js'
}
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'libs',
filename: 'libs.js'
})
]
};
... ...