# Vue-自定义配置脚手架 **Repository Path**: yy-123/vue_test1 ## Basic Information - **Project Name**: Vue-自定义配置脚手架 - **Description**: 从无到有配置vue单页 简单项目直接安装使用,简单方便 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-07-10 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README -------- webpack初始配置-------- 1.项目初始化 cd 'to/your/path' npm init 2.npm install --save-dev webpack (如果是webpack 4+ 版本还需要安装 npm install --save-dev webpack-cli) 3. 配置package.json添加开发环境生产环境 "build": "webpack --mode production" 4.新建并配置webpack.config.js 配置入口 出口 loader 插件 接着可以测试进行运行 npm run bulid查看命令效果,生成了对应的打包文件 5.安装html-webpack-plugin npm install html-webpack-plugin --save-dev const HtmlWebpackPlugin = require('html-webpack-plugin'); plugins:[ ... new HtmlWebpackPlugin({ title:'vue 学习', filename:'index.html', template:path.resolve(__dirname, "index.html") }), ... ] -------- webpack安装vue进行使用-------- 6.安装Vue npm install vue-loader vue-template-compiler webpack配置文件添加 const VueLoaderPlugin = require('vue-loader/lib/plugin'); 修改main.js: import Vue from 'vue'; var App = new Vue({ el:'#main', data:{ message:'Hello world' } }) 修改index.html: