https://github.com/juntingl/web_front_end_env
基于 Webpack 4 搭建前端开发环境
https://github.com/juntingl/web_front_end_env
webpack
Last synced: about 2 months ago
JSON representation
基于 Webpack 4 搭建前端开发环境
- Host: GitHub
- URL: https://github.com/juntingl/web_front_end_env
- Owner: juntingl
- Created: 2018-11-14T02:05:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-14T02:11:47.000Z (over 7 years ago)
- Last Synced: 2024-12-27T14:44:12.540Z (over 1 year ago)
- Topics: webpack
- Language: JavaScript
- Size: 46.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Webpack 知识点回顾
* `webpack` 构建 `production` 环境下代码时,会自动 `tree shaking` 清理无用多余的代码。但是检查不到函数和 `scope(块)`内部,无法 `tree shaking`。
```js
import lodash from 'lodash-es';
const sync = function () {
console.log('Sync')
}
const isArray = function (args) { // 此函数没有调用过,按理 tree shaking 会把 lodash、isArray 去除,但并没有
console.log(lodash.isArray(args))
}
export {
sync,
isArray
}
```
* 启用 `CSS modules`,根据文件夹为一个模块,在外面通过 module.test 的方式使用