webpack分块打包优化性能
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
// const AV = require('leancloud-storage');
|
||||
window.AV = require('leancloud-storage');
|
||||
const Valine = require('../lib/Valine.min');
|
||||
// const Valine = require('../lib/Valine.min');
|
||||
/**
|
||||
* Valine.min.js.bak文件, 是根据Valine项目源代码重新打包的
|
||||
* 使用根据Valine项目源代码重新打包
|
||||
* 可以支持对于AV对象的传参输入, 而不需要暴露全局变量
|
||||
* 但是缺少一些新功能
|
||||
*/
|
||||
// 评论配置
|
||||
const commentConfig = require("../config/comment.json");
|
||||
const commentConfig = require("../config/comment.json")
|
||||
|
||||
if(window.yiliaConfig.isPost && commentConfig.valine.enable) {
|
||||
commentConfig.valine.config.path = window.location.pathname;
|
||||
// commentConfig.valine.config.av = AV;
|
||||
new Valine(commentConfig.valine.config);
|
||||
}
|
||||
import(/* webpackChunkName: "valine" */ '../lib/Valine.min').then(({ default: Valine }) => {
|
||||
commentConfig.valine.config.path = window.location.pathname
|
||||
// commentConfig.valine.config.av = AV;
|
||||
new Valine(commentConfig.valine.config)
|
||||
})
|
||||
|
||||
@@ -14,3 +14,8 @@ Util.addLoadEvent(function() {
|
||||
// Viewer.init()
|
||||
Aside.init()
|
||||
})
|
||||
const commentConfig = require("../config/comment.json")
|
||||
if(window.yiliaConfig.isPost && commentConfig.valine.enable) {
|
||||
// 如果是文章详情页面, 并且启用了评论, 则加载评论相关代码
|
||||
import(/* webpackChunkName: "comment" */ './comment')
|
||||
}
|
||||
Reference in New Issue
Block a user