Authored by 毕凯

libs 独立

... ... @@ -28,9 +28,11 @@
{{{body}}}
{{/if}}
{{> footer}}
{{#if devEnv}}
{{#if devEnv}}
<script src="//localhost:5002/libs.js"></script>
<script src="//localhost:5002/{{module}}.{{page}}.js"></script>
{{^}}
{{^}}
<script src="//cdn.yoho.cn/yohobuy-node/{{version}}/libs.js"></script>
<script src="//cdn.yoho.cn/yohobuy-node/{{version}}/{{module}}.{{page}}.js"></script>
{{/if}}
</body>
... ...
... ... @@ -87,12 +87,9 @@
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1",
"webpack-stream": "^3.1.0",
"yoho-fastclick": "^1.0.6",
"yoho-hammer": "^2.0.7",
"yoho-handlebars": "^4.0.5",
"yoho-jquery": "^1.12.4",
"yoho-jquery-lazyload": "^1.9.7",
"yoho-slider": "0.0.2",
"yoho-swiper": "^3.3.1"
"yoho-slider": "0.0.2"
}
}
... ...
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.
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports) {
/***/ }
/******/ ]);
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -185,15 +185,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,6 +6,7 @@
'use strict';
const webpack = require('webpack');
const path = require('path');
const _ = require('lodash');
const shelljs = require('shelljs');
... ... @@ -18,6 +19,12 @@ 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-handlebars',
'yoho-jquery',
'yoho-jquery-lazyload',
'yoho-slider'
];
});
module.exports = {
... ... @@ -25,5 +32,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'
})
]
};
... ...