脚手架安装及打包

一.安装node.js
https://nodejs.org/en/ 查看版本node -v 查看npm版本 npm -v

二.安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org 查看版本cnpm -v

三.安装webpack
npm install webpack -g (npm install webpack --save-dev)

四.安装vue

npm install -g @vue/cli    3.0版本(需要2.0版本安装完这个安装下一个)
npm install -g @vue/cli-init   2.0版本

(cnpm install --global vue-cli)

查看版本vue -V

参考教程:https://segmentfault.com/a/1190000011275993
https://www.cnblogs.com/jinzy/p/6496103.html
https://www.cnblogs.com/wisewrong/p/9740173.html
https://www.cnblogs.com/wisewrong/p/6255817.html

新建项目3.0

vue create hello-world
一路Y
cd进入目录
npm run serve

打包3.0

npm run build

npx vue-cli-service build

新建项目2.0

1.vue init webpack my-project
2.一路Y
3.cd 进入目录
4.npm run dev

webpack打包

1.config下的index.js

dev: {

// Paths
assetsSubDirectory: 'static',
assetsPublicPath: './',
proxyTable: {},

build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),

// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',

2.npm run build

dist目录上传到服务器即可(直接运行index.html)

 

posted @ 2018-12-13 20:13  programmer博客  阅读(567)  评论(0编辑  收藏  举报