QingWei-Li on v1.5.5
QingWei-Li on master
fix: upgrade extract-text-webpa… v1.5.5 (compare)
QingWei-Li on v1.5.4
fix: extract-text-webpack-plugi… v1.5.4 (compare)
QingWei-Li on master
fix: extract-text-webpack-plugi… v1.5.4 (compare)
import Vue from 'vue';
import App from './app';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
const routes = [
{
path: '/home',
component: resolve => require(['./pages/home.vue'], resolve)
}
];
const router = new VueRouter({
mode: 'hash',
base: __dirname,
routes
});
new Vue({ // eslint-disable-line
el: '#app',
router,
render: h => h(App)
});
App.vue
<template>
<div>
<div>hello</div>
<router-view></router-view>
</div>
</template>
home.vue
<template>
<div>123</div>
</template>
cooking.set({
entry: {
app: './src/index.js',
vendor: ['vue']
},
dist: './dist',
clear: true, // 每次打包都清理掉 dist 目录
hash: true,
sourceMap: true,
template: './index.html',
devServer: { port: 8888, publicPath: '/' },
postcss: [
require('postcss-salad')
],
extractCSS: true, // 提取 CSS 文件
chunk: [
'vendor', // entry 里定义的入口文件,也就是会将 vue 单独打包
'manifest' // 这个并没有在 entry 里声明的会将所有公用部分打包,也就是 webpack runtime
],
publicPath: '/', // 打包后的资源文件相对于 url 的路径
extends: ['vue2', 'lint']
});
[cooking] - Loaded success: vue2
[cooking] - Loaded success: lint
Build completed in 24.499s
[cooking] - info
Time: 24503ms
Asset Size Chunks Chunk Names
app.13365cc.css 129 kB 0, 2 [emitted] app
static/element-icons.a61be9c.eot 13.5 kB [emitted]
static/element-icons.b02bdc1.ttf 13.2 kB [emitted]
app.cf058b7.js 478 kB 0, 2 [emitted] app
vendor.0f50048.js 49.8 kB 1, 2 [emitted] vendor
manifest.cf026df.js 1.41 kB 2 [emitted] manifest
static/element-icons.09162bc.svg 17.4 kB [emitted]
app.cf058b7.js.map 3.45 MB 0, 2 [emitted] app
app.13365cc.css.map 17.4 kB 0, 2 [emitted] app
vendor.0f50048.js.map 385 kB 1, 2 [emitted] vendor
manifest.cf026df.js.map 13.4 kB 2 [emitted] manifest
index.html 391 bytes [emitted]