[Doc] fix tree shaking when build site

This commit is contained in:
陈嘉涵 2019-06-21 15:53:28 +08:00
parent 8564a5b1f1
commit 6e93c93d46
3 changed files with 32 additions and 30 deletions

View File

@ -49,6 +49,7 @@ module.exports = {
},
{
test: /\.less$/,
sideEffects: true,
use: [
'style-loader',
'css-loader',
@ -63,10 +64,7 @@ module.exports = {
},
{
test: /\.md$/,
use: [
'vue-loader',
'@vant/markdown-loader'
]
use: ['vue-loader', '@vant/markdown-loader']
},
{
test: /\.(ttf|svg)$/,

View File

@ -3,7 +3,9 @@ import docConfig from './doc.config';
import DemoList from './components/DemoList';
import DemoPages from './components/DemoPages';
import { demoWrapper } from './demo-common';
import './utils/iframe-router';
import { initIframeRouter } from './utils/iframe-router';
initIframeRouter();
const registerRoute = ({ mobile, componentMap }) => {
const route = [

View File

@ -5,6 +5,7 @@
import { setLang } from './lang';
import { iframeReady, isMobile } from '.';
export function initIframeRouter() {
window.syncPath = function () {
const router = window.vueRouter;
const isInIframe = window !== window.top;
@ -32,3 +33,4 @@ window.changePath = function (lang, path = '') {
setLang(lang);
window.vueRouter.replace(path);
};
}