An open API service indexing awesome lists of open source software.

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 搭建前端开发环境

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 的方式使用