@@ -1 +0,0 @@
-<!doctype html><html><head><meta charset="utf-8"><title>你好啊</title><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="main.js"></script></head><body></body></html>
-console.log("!11"),console.log("23211"),console.log(96),console.log(25);
@@ -13,7 +13,13 @@
"webpack": "^5.98.0",
"webpack-cli": "^6.0.1"
},
+ "scripts": {
+ "dev":"webpack server --open"
+ },
"browserslist": [
"defaults"
- ]
+ ],
+ "devDependencies": {
+ "webpack-dev-server": "^5.2.1"
+ }
}
@@ -1,6 +1,6 @@
// import Pic from '../assets/1.jpg';
-// import '../style/index.css';
+import '../style/index.css';
-// document.body.insertAdjacentHTML('beforeend','<h1>第一个案例</h1>')
+document.body.insertAdjacentHTML('beforeend','<h1>第一个案例</h1>')
// document.body.insertAdjacentHTML('beforeend',`<img src=${Pic} />>`)
let a = 24;
let b = 1;
@@ -3,7 +3,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
// 抛出
module.exports = {
mode: "production",
- entry: "./src/b.js",
+ // entry: "./src/b.js",
// entry:'./news.js',
@@ -41,5 +41,6 @@ module.exports = {
],
- plugins: [new HtmlWebpackPlugin({title:"你好啊"})],
+ plugins: [new HtmlWebpackPlugin({title:"你好啊1"})],
+ devtool:"inline-source-map"
};
@@ -24,4 +24,8 @@ filename:
10. babel插件
11. plugin插件
12. 模式:mode
-13. 开发服务器
+13. 开发服务器
+ yarn add -D webpack-dev-server 安装
+ yarn webpack server 启动开发服务器
+ yarn webpack server --open 自动打包
+14. 映射源码