webpack4:实时打包之webpack-dev-server
2021-08-15 13:58
标签:port splay 说明 lan reset lock asc aaaaaa 配置 1、安装: cnpm i webpack-dev-server -D 2、package.json中配置命令: "dev": "webpack-dev-server --open chrome --port 3000 --hot --host 127.0.0.1" { "name": "wp4-1", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "webpack-dev-server --open chrome --port 3000 --hot --host 127.0.0.1" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "webpack": "^4.41.5", "webpack-cli": "^3.3.10", "webpack-dev-server": "^3.10.1" } } 3、运行命令打包“npm run dev” 说明:webpack-dev-server实时打包好的main.js是托管在内存中,所以在项目根目录中看不到,但是我们可以认为在项目根目录中有一个看不见的main.js。 4、http://127.0.0.1:3000/src/预览index.html文件: Document 首页 webpack4:实时打包之webpack-dev-server标签:port splay 说明 lan reset lock asc aaaaaa 配置 原文地址:https://www.cnblogs.com/samve/p/12331684.html
文章标题:webpack4:实时打包之webpack-dev-server
文章链接:http://soscw.com/index.php/essay/107464.html