Skip to content

Commit 532f447

Browse files
committed
optimize production build
1 parent 1543401 commit 532f447

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

.babelrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
}],
99
"stage-2"
1010
],
11-
"plugins": ["transform-runtime"],
11+
"plugins": ["transform-runtime", ["component", [
12+
{
13+
"libraryName": "element-ui",
14+
"styleLibraryName": "~theme"
15+
}
16+
]]],
1217
"env": {
1318
"test": {
1419
"presets": ["env", "stage-2"],

config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
assetsRoot: path.resolve(__dirname, '../dist'),
99
assetsSubDirectory: 'static',
1010
assetsPublicPath: '/',
11-
productionSourceMap: true,
11+
productionSourceMap: false,
1212
// Gzip off by default as many popular static hosts such as
1313
// Surge or Netlify already gzip all static assets for you.
1414
// Before setting to `true`, make sure to:

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<title>上海大学开源社区 | 主页</title>
66
<link rel="shortcut icon" href="static/favicon.ico">
77
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0"/>
8+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
89
</head>
910
<body>
1011
<div id="app"></div>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"babel-core": "^6.22.1",
2323
"babel-eslint": "^7.1.1",
2424
"babel-loader": "^7.1.1",
25+
"babel-plugin-component": "^0.10.0",
2526
"babel-plugin-transform-runtime": "^6.22.0",
2627
"babel-preset-env": "^1.3.2",
2728
"babel-preset-stage-2": "^6.22.0",

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
.title.text-center 社区成员
9595
.hr.element-center
9696
el-carousel(:type="carouselType" height="400px", :interval="6000")
97-
el-carousel-item.card(v-for="member in members")
97+
el-carousel-item.card(v-for="member in members", :key="member.name")
9898
img.avatar(:src="member.avatar")
9999
.name {{member.name}}
100100
.title {{member.title}}

src/main.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
33
import Vue from 'vue'
44
import App from './App'
5-
import ElementUI from 'element-ui'
5+
import {Button, Icon, Col, Row, Carousel, CarouselItem} from 'element-ui'
66
import '../theme/index.css'
77
import FlatSurfaceShader from 'vue-flat-surface-shader'
88
import headroom from 'vue-headroom'
99
import ScrollSpy from './lib/Scrollspy'
1010
require('../node_modules/font-awesome/css/font-awesome.css')
1111

1212
Vue.config.productionTip = false
13-
Vue.use(ElementUI)
13+
Vue.use(Button)
14+
Vue.use(Icon)
15+
Vue.use(Col)
16+
Vue.use(Row)
17+
Vue.use(Carousel)
18+
Vue.use(CarouselItem)
1419
Vue.use(FlatSurfaceShader)
1520
Vue.use(headroom)
1621
Vue.use(ScrollSpy)

0 commit comments

Comments
 (0)