perf: update dev env

This commit is contained in:
tjz 2018-06-16 21:47:32 +08:00
parent 5cca28a8d0
commit d356e4dcc6
4 changed files with 36 additions and 11 deletions

View File

@ -22,6 +22,7 @@
"es"
],
"scripts": {
"dev": "NODE_ENV=development ENTRY_INDEX=dev ./node_modules/.bin/webpack-dev-server --open --hot --port 3001",
"start": "NODE_ENV=development ./node_modules/.bin/webpack-dev-server --open --hot",
"test": "jest --config .jest.js",
"site": "node scripts/run.js site-dist",
@ -136,11 +137,13 @@
"vue": "^2.5.16",
"vue-antd-md-loader": "^1.0.3",
"vue-clipboard2": "0.0.8",
"vue-infinite-scroll": "^2.0.2",
"vue-jest": "^2.5.0",
"vue-loader": "^13.0.5",
"vue-router": "^3.0.1",
"vue-server-renderer": "^2.5.16",
"vue-template-compiler": "^2.5.16",
"vue-virtual-scroller": "^0.12.0",
"webpack": "^3.11.0",
"webpack-chunk-hash": "^0.5.0",
"webpack-dev-server": "^2.8.2",
@ -166,4 +169,4 @@
"shallowequal": "^1.0.2",
"warning": "^3.0.0"
}
}
}

31
site/dev.js Normal file
View File

@ -0,0 +1,31 @@
import 'babel-polyfill'
import '../components/style.js'
import './index.less'
import 'highlight.js/styles/solarized-light.css'
import Vue from 'vue'
import VueRouter from 'vue-router'
import VueClipboard from 'vue-clipboard2'
import Md from './components/md'
import Api from './components/api'
import './components'
import demoBox from './components/demoBox'
import demoContainer from './components/demoContainer'
import Test from '../components/list/demo/index'
Vue.use(VueClipboard)
Vue.use(VueRouter)
Vue.component(Md.name, Md)
Vue.component(Api.name, Api)
Vue.component('demo-box', demoBox)
Vue.component('demo-container', demoContainer)
const router = new VueRouter({
mode: 'history',
routes: [
{ path: '/*', component: Test },
],
})
new Vue({
el: '#app',
router,
})

View File

@ -1,13 +1,6 @@
import Layout from './components/layout.vue'
import Iframe from './components/iframe.vue'
const AsyncTestComp = () => {
const d = window.location.hash.replace('#', '')
return {
component: import(`../components/input-number/demo/${d}`),
}
}
export default [
{ path: '/ant-design/components/:name/', component: Layout, props: true },
{ path: '/ant-design/iframe/:name/', component: Iframe, props: true },
@ -70,7 +63,5 @@ export default [
{ path: '', redirect: '/ant-design/vue/docs/introduce/' },
],
},
{ path: '/:prefix?/test/:demo?/', component: AsyncTestComp },
{ path: '/*', redirect: '/ant-design/docs/vue/introduce/' },
]

View File

@ -133,7 +133,7 @@ md.core.ruler.push('update_template', function replace ({ tokens }) {
module.exports = {
entry: {
index: [
'./site/index.js',
`./site/${process.env.ENTRY_INDEX || 'index'}.js`,
],
},
module: {