# webpack5-learn **Repository Path**: li3346756362/webpack5-learn ## Basic Information - **Project Name**: webpack5-learn - **Description**: webpack5面试题 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 3 - **Created**: 2025-06-02 - **Last Updated**: 2025-06-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # webpack5 study 升级 webpack5 以及周边插件后,代码需要做出的调整: - package.json 的 dev-server 命令改了 `"dev": "webpack serve --config build/webpack.dev.js",` - 升级新版本 `const { merge } = require('webpack-merge')` - 升级新版本 `const { CleanWebpackPlugin } = require('clean-webpack-plugin')` - `module.rules` 中 `loader: ['xxx-loader']` 换成 `use: ['xxx-loader']` - `filename: 'bundle.[contenthash:8].js'` 其中 `h` 小写,不能大写 ### 关键点 ``` "browserslist":{ // 默认生产环境 "development": [ "last 1 chrome version", // 兼容最近的一个chrome版本 "last 1 firefox version", "last 1 safari version" ], "production":[ ">0.2%", "not dead", // 不要已经丢弃的浏览器 "not op_mini all" 不要所有的欧朋浏览器 ] } ```