Skip to content

Commit

Permalink
vue脚手架添加按需加载
Browse files Browse the repository at this point in the history
  • Loading branch information
陈斌 committed May 7, 2018
1 parent 5892b79 commit 32f6608
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
Binary file added vueGenerator/.DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions vueGenerator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "this is a react generator",
"main": "index.js",
"scripts": {
"start": "webpack --mode development",
"build": "webpack --mode production",
"server": "webpack-dev-server --mode development --open"
"start": "rm -rf dist && webpack --mode development",
"build": "rm -rf dist && webpack --mode production",
"server": "webpack-dev-server --mode production --open"
},
"keywords": [
"vue",
Expand Down
4 changes: 2 additions & 2 deletions vueGenerator/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div id="app">
hello world
<router-view/>
hello world2
<router-view />
</div>
</template>

Expand Down
8 changes: 4 additions & 4 deletions vueGenerator/src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '../components/HelloWorld'
import About from '../components/About'
import AboutCompany from '../components/AboutCompany'
const HelloWorld = () => import('../components/HelloWorld')
const About = () => import('../components/About')
const AboutCompany = () => import('../components/AboutCompany')

Vue.use(Router)

export default new Router({
mode: 'history',
mode: 'hash',
routes: [{
path: '/',
name: 'HelloWorld',
Expand Down
5 changes: 5 additions & 0 deletions vueGenerator/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,10 @@ module.exports = {
alias: {
vue: 'vue/dist/vue.js'
}
},
output: {
filename: `[name].[hash:8].js`,
chunkFilename: `[name].[chunkhash:8].js`
}

}

0 comments on commit 32f6608

Please sign in to comment.