Skip to content

Commit

Permalink
feat(case-sensitive=paths): 严格区分大小写
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxue committed Dec 14, 2019
1 parent e95e772 commit 164b04d
Show file tree
Hide file tree
Showing 22 changed files with 576 additions and 2,414 deletions.
79 changes: 40 additions & 39 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
## 1.0.6 (2019-12-13)
## 1.0.6 (2019-12-14)

### 🌟 新功能
范围|描述|commitId
--|--|--
编译 | 提升编译速度,增加了 cache-loader dllPlugin threadLoader | [4d44ad7](https://github.com/luoxue-victor/learn_webpack/commit/4d44ad7)
抽离 commander 层 | 修改脚手架二次调用的bug,增加了commander 层 | [b1aa749](https://github.com/luoxue-victor/learn_webpack/commit/b1aa749)
多页面 | webpack配置多页面打包 | [86a0418](https://github.com/luoxue-victor/learn_webpack/commit/86a0418)
课题2 | 完成基本构建,js、css打包进html,实现dev跟build环境 | [71a6a19](https://github.com/luoxue-victor/learn_webpack/commit/71a6a19)
新增loader配置 | 增加ts、css、less、sass、postcss、babel配置 | [53616f8](https://github.com/luoxue-victor/learn_webpack/commit/53616f8)
性能优化 | 性能优化1 | [0909b33](https://github.com/luoxue-victor/learn_webpack/commit/0909b33)
修改了配置文件 | i feat a config | [382c60c](https://github.com/luoxue-victor/learn_webpack/commit/382c60c)
alias | 配置别名 第13课时 | [804f932](https://github.com/luoxue-victor/learn_webpack/commit/804f932)
all | 初始化一个项目 | [336cc13](https://github.com/luoxue-victor/learn_webpack/commit/336cc13)
asdasdasdas | 你爱哈的 | [ea12f9c](https://github.com/luoxue-victor/learn_webpack/commit/ea12f9c)
auto readme | 自动生成 readme 文件 | [1e0a526](https://github.com/luoxue-victor/learn_webpack/commit/1e0a526)
autoprefixer | css 自动添加前缀 | [4e88451](https://github.com/luoxue-victor/learn_webpack/commit/4e88451)
config | add config option | [83c9f1e](https://github.com/luoxue-victor/learn_webpack/commit/83c9f1e)
create readme | 创建readme | [571bfaa](https://github.com/luoxue-victor/learn_webpack/commit/571bfaa)
daasd | asdasd | [0b6ee85](https://github.com/luoxue-victor/learn_webpack/commit/0b6ee85)
docs | 整理文档 | [32d578f](https://github.com/luoxue-victor/learn_webpack/commit/32d578f)
env | 添加环境变量插件 | [e95e772](https://github.com/luoxue-victor/learn_webpack/commit/e95e772)
eslint | 增加 eslint,并保存是自动修复 | [6dd3812](https://github.com/luoxue-victor/learn_webpack/commit/6dd3812)
feat | aaaaa | [73abf42](https://github.com/luoxue-victor/learn_webpack/commit/73abf42)
feat | asdada | [64090c7](https://github.com/luoxue-victor/learn_webpack/commit/64090c7)
init | 项目初始化 | [d7835fb](https://github.com/luoxue-victor/learn_webpack/commit/d7835fb)
lint-staged | 添加 lint-staged,并修改课题10文档 | [a84dff0](https://github.com/luoxue-victor/learn_webpack/commit/a84dff0)
options-chain | 增加可选链并完善文档 | [b188007](https://github.com/luoxue-victor/learn_webpack/commit/b188007)
plugin | 增加课题8 写一个webpack插件 | [0d021ce](https://github.com/luoxue-victor/learn_webpack/commit/0d021ce)
sourcemap | 开启了sourcemap | [5022873](https://github.com/luoxue-victor/learn_webpack/commit/5022873)
ssr | 增加ssr配置 | [d4c4b7d](https://github.com/luoxue-victor/learn_webpack/commit/d4c4b7d)
stylelint | 新增stylelint功能 | [3d7143a](https://github.com/luoxue-victor/learn_webpack/commit/3d7143a)
ts | 测试ts引用ts文件 | [4a47ee1](https://github.com/luoxue-victor/learn_webpack/commit/4a47ee1)
tslint | 12课时,tslint配置 | [8b24f6a](https://github.com/luoxue-victor/learn_webpack/commit/8b24f6a)
webpack | webpack配置 | [9a1d29c](https://github.com/luoxue-victor/learn_webpack/commit/9a1d29c)
webpack5 | 升级webpack5,脚手架实现可以在4/5之间自由切换 | [2f4484c](https://github.com/luoxue-victor/learn_webpack/commit/2f4484c)
你好 | [6e534da](https://github.com/luoxue-victor/learn_webpack/commit/6e534da)
asasdasasd | [8f9515f](https://github.com/luoxue-victor/learn_webpack/commit/8f9515f)
asd | [d278787](https://github.com/luoxue-victor/learn_webpack/commit/d278787)


### 📝 文档
范围|描述|commitId
Expand Down Expand Up @@ -39,44 +78,6 @@
Initial commit | [18fbebf](https://github.com/luoxue-victor/learn_webpack/commit/18fbebf)


### 🌟 新功能
范围|描述|commitId
--|--|--
编译 | 提升编译速度,增加了 cache-loader dllPlugin threadLoader | [4d44ad7](https://github.com/luoxue-victor/learn_webpack/commit/4d44ad7)
抽离 commander 层 | 修改脚手架二次调用的bug,增加了commander 层 | [b1aa749](https://github.com/luoxue-victor/learn_webpack/commit/b1aa749)
多页面 | webpack配置多页面打包 | [86a0418](https://github.com/luoxue-victor/learn_webpack/commit/86a0418)
课题2 | 完成基本构建,js、css打包进html,实现dev跟build环境 | [71a6a19](https://github.com/luoxue-victor/learn_webpack/commit/71a6a19)
新增loader配置 | 增加ts、css、less、sass、postcss、babel配置 | [53616f8](https://github.com/luoxue-victor/learn_webpack/commit/53616f8)
性能优化 | 性能优化1 | [0909b33](https://github.com/luoxue-victor/learn_webpack/commit/0909b33)
修改了配置文件 | i feat a config | [382c60c](https://github.com/luoxue-victor/learn_webpack/commit/382c60c)
alias | 配置别名 第13课时 | [804f932](https://github.com/luoxue-victor/learn_webpack/commit/804f932)
all | 初始化一个项目 | [336cc13](https://github.com/luoxue-victor/learn_webpack/commit/336cc13)
asdasdasdas | 你爱哈的 | [ea12f9c](https://github.com/luoxue-victor/learn_webpack/commit/ea12f9c)
auto readme | 自动生成 readme 文件 | [1e0a526](https://github.com/luoxue-victor/learn_webpack/commit/1e0a526)
autoprefixer | css 自动添加前缀 | [4e88451](https://github.com/luoxue-victor/learn_webpack/commit/4e88451)
config | add config option | [83c9f1e](https://github.com/luoxue-victor/learn_webpack/commit/83c9f1e)
create readme | 创建readme | [571bfaa](https://github.com/luoxue-victor/learn_webpack/commit/571bfaa)
daasd | asdasd | [0b6ee85](https://github.com/luoxue-victor/learn_webpack/commit/0b6ee85)
docs | 整理文档 | [32d578f](https://github.com/luoxue-victor/learn_webpack/commit/32d578f)
eslint | 增加 eslint,并保存是自动修复 | [6dd3812](https://github.com/luoxue-victor/learn_webpack/commit/6dd3812)
feat | aaaaa | [73abf42](https://github.com/luoxue-victor/learn_webpack/commit/73abf42)
feat | asdada | [64090c7](https://github.com/luoxue-victor/learn_webpack/commit/64090c7)
init | 项目初始化 | [d7835fb](https://github.com/luoxue-victor/learn_webpack/commit/d7835fb)
lint-staged | 添加 lint-staged,并修改课题10文档 | [a84dff0](https://github.com/luoxue-victor/learn_webpack/commit/a84dff0)
options-chain | 增加可选链并完善文档 | [b188007](https://github.com/luoxue-victor/learn_webpack/commit/b188007)
plugin | 增加课题8 写一个webpack插件 | [0d021ce](https://github.com/luoxue-victor/learn_webpack/commit/0d021ce)
sourcemap | 开启了sourcemap | [5022873](https://github.com/luoxue-victor/learn_webpack/commit/5022873)
ssr | 增加ssr配置 | [d4c4b7d](https://github.com/luoxue-victor/learn_webpack/commit/d4c4b7d)
stylelint | 新增stylelint功能 | [3d7143a](https://github.com/luoxue-victor/learn_webpack/commit/3d7143a)
ts | 测试ts引用ts文件 | [4a47ee1](https://github.com/luoxue-victor/learn_webpack/commit/4a47ee1)
tslint | 12课时,tslint配置 | [8b24f6a](https://github.com/luoxue-victor/learn_webpack/commit/8b24f6a)
webpack | webpack配置 | [9a1d29c](https://github.com/luoxue-victor/learn_webpack/commit/9a1d29c)
webpack5 | 升级webpack5,脚手架实现可以在4/5之间自由切换 | [2f4484c](https://github.com/luoxue-victor/learn_webpack/commit/2f4484c)
你好 | [6e534da](https://github.com/luoxue-victor/learn_webpack/commit/6e534da)
asasdasasd | [8f9515f](https://github.com/luoxue-victor/learn_webpack/commit/8f9515f)
asd | [d278787](https://github.com/luoxue-victor/learn_webpack/commit/d278787)


### 🐛 Bug 修复
范围|描述|commitId
--|--|--
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
- [课题 12:添加 tslint](./docs/课时-12.md)
- [课题 13:配置别名](./docs/课时-13.md)
- [课时 14:升级 webpack5](./docs/课时-14.md)
- [课时 15:定义变量](./docs/课时-15.md)
- [课时 15:定义通用变量](./docs/课时-15.md)
- [课时 16:严格区分路径大小写](./docs/课时-16.md)

</details>

Expand Down Expand Up @@ -91,7 +92,7 @@ webpack-box upgrade 5 # 可以切换到 webpack5/4
- [打包分析](./config/BundleAnalyzerPlugin.js)
- [开启gzip](./config/CompressionWebpackPlugin.js)
- [dll-plugin 配置](./config/DllPlugin.js)
- [EnvironmentPlugin 定义全局变量](./config/EnvironmentPlugin.js)
- [EnvironmentPlugin 定义通用变量](./config/EnvironmentPlugin.js)
- [fork-ts-checher 检查ts类型](./config/ForkTsChecker.js)
- [friendly-errors-webpack-plugin 友好错误提示](./config/FriendlyErrorsWebpackPlugin.js)
- [html-webpack-plugin 生成html](./config/HtmlWebpackPlugin.js)
Expand All @@ -100,6 +101,7 @@ webpack-box upgrade 5 # 可以切换到 webpack5/4
- [babel-loader 配置](./config/babelLoader.js)
- [基础配置](./config/base.js)
- [cache-loader 配置(webpack 5 弃用)](./config/cacheLoader.js)
- [CaseSensitivePaths 严格区分大小写](./config/caseSensitivePaths.js)
- [eslint-loader 配置](./config/eslintLoader.js)
- [提取 manifest](./config/manifest.js)
- [optimization 优化配置](./config/optimization.js)
Expand Down
5 changes: 3 additions & 2 deletions build/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ const resolve = (p) => {
return path.join(process.cwd(), p)
}

const webpackVersion = require(resolve('node_modules/webpack/package.json')).version

module.exports = (options) => {
const map = new Map()

files.map(_ => {
const name = path.basename(_, '.js')
return map.set(name, require(_)({ config, resolve, options, api: PluginAPI }))
return map.set(name, require(_)({ config, webpackVersion, resolve, options, api: PluginAPI }))
})

map.forEach(v => v())
Expand Down
2 changes: 1 addition & 1 deletion config/EnvironmentPlugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// [EnvironmentPlugin 定义全局变量]
// [EnvironmentPlugin 定义通用变量]
const webpack = require('webpack')

module.exports = ({ config, resolve, options }) => {
Expand Down
6 changes: 4 additions & 2 deletions config/base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// [基础配置]
module.exports = ({ config, resolve, options }) => {
module.exports = ({ config, webpackVersion, resolve, options }) => {
let name = 'app'
let entry = options.entry || 'src/main.js'
let output = options.output || 'dist'
Expand Down Expand Up @@ -27,8 +27,10 @@ module.exports = ({ config, resolve, options }) => {
.path(resolve(output))
.filename('[name].bundle.js')
.publicPath(publicPath)
.set('ecmaVersion', 6)

if (parseInt(webpackVersion) === 5) {
config.output.set('ecmaVersion', 6)
}
config.devtool('cheap-source-map')
}
}
10 changes: 10 additions & 0 deletions config/caseSensitivePaths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// [CaseSensitivePaths 严格区分大小写]
module.exports = ({ config, webpackVersion, resolve, options }) => {
return () => {
// webpack 5 不兼容
if (parseInt(webpackVersion) >= 5) return
config
.plugin('case-sensitive-paths')
.use(require('case-sensitive-paths-webpack-plugin'))
}
}
7 changes: 4 additions & 3 deletions config/optimization.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// [optimization 优化配置]
module.exports = ({ config }) => {
module.exports = ({ config, webpackVersion }) => {
const v = parseInt(webpackVersion)
return () => {
config
.optimization.splitChunks({
chunks: 'async',
// webpack5
// https://github.com/webpack/changelog-v5#splitchunks-and-module-sizes
minSize: {
minSize: v === 5 ? {
javascript: 30000,
style: 50000
},
} : 30000,
minChunks: 1,
maxAsyncRequests: 3,
maxInitialRequests: 3,
Expand Down
55 changes: 55 additions & 0 deletions dist/index/0.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added dist/index/0.bundle.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions dist/index/0.bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions dist/index/1.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added dist/index/1.bundle.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions dist/index/1.bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions dist/index/1.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/index/1.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 164b04d

Please sign in to comment.