- yarn add vue
- yarn add webpack
- yarn add webpack-cli
- yarn add html-webpack-plugin
- yarn add webpack-dev-server
- 创建build、src文件夹
- 创建index.html文件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Vue</title> </head> <body> <div id="app"></div> </body> </html>
- 创建src/index.js文件
import Vue from 'vue' new Vue({ el:'#app', render(h){ return h('div','hello world!') } })
- 创建build/webpack.dev.conf.js文件
const HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = { entry: './src/index', output: { filename:'./dist/main.js' }, plugins:[new HtmlWebpackPlugin({ filename:'index.html', template:'./src/index.html', inject:true //true夹在在文件尾部 })], devServer: { port:1222, open:true//自动打开浏览器 } }
- 在package.json中添加scripts
- yarn start 启动项目
相关文章
- 使用Vue脚手架(vue-cli)从零搭建一个vue项目(包含vue项目结构展示)
- 零基础 Vue 开发环境搭建 打开运行Vue项目
- 前端知识分享——Vue3 + Vite + TypeScript 搭建基础项目
- 如何通过idea搭建一个SpringBoot的Web项目(最基础版)
- AS3项目基础框架搭建分享robotlegs2 + starling1.3 + feathers1.1
- (4)Vue 3 + Vite + Axios + Pinia + Tailwind CSS搭建一个基础框架-6. 项目结构
- Maven 基础环境搭建 项目依赖jar包导入
- vue-cli搭建项目结构及引用bootstrap
- 快速搞定用Vue+Webpack搭建前端项目(学习好久了,该写点东西了......)
- vue 快速入门 系列 —— 使用 vue-cli 3 搭建一个项目(上)