Skip to content

Commit

Permalink
feat: remove hardSource (umijs#2214)
Browse files Browse the repository at this point in the history
##### Checklist

- [x] `npm test` passes
- [x] tests are included
- [x] documentation is changed or added
- [x] commit message follows commit guidelines


##### Description of change

[hardSource] is no longer valid

- close umijs#2213
  • Loading branch information
xiaohuoni authored and sorrycc committed Apr 6, 2019
1 parent 7776f11 commit 1a89937
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 39 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@ Deploy doc to [umijs.org](https://umijs.org/).
```bash
$ y doc:deploy
```

## Tips

Please use node@10, node@11 is not supported.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ English | [简体中文](./README_zh-CN.md)
* 🎉 **Complete plugin system**, covering every lifecycle from source code to production
* 🚀 **High performance**, with support for PWA, route-level code splitting, etc. via plugins
* 💈 **Support for static export**, adapt to various environments, such as console app, mobile app, [egg](https://github.com/eggjs/egg), Alipay wallet, etc
* 🚄 **Fast dev startup**, support enable [dll](https://umijs.org/plugin/umi-plugin-react.html#dll) and [hard-source-webpack-plugin](https://umijs.org/plugin/umi-plugin-react.html#hardSource) with config
* 🚄 **Fast dev startup**, support enable [dll](https://umijs.org/plugin/umi-plugin-react.html#dll) with config
* 🐠 **Compatible with IE9**, based on [umi-plugin-polyfills](https://umijs.org/plugin/umi-plugin-react.html#polyfills)
* 🍁 **Support TypeScript**, including d.ts definition and `umi test`
* 🌴 **Deep integration with [dva](https://dvajs.com/)**, support duck directory, automatic loading of model, code splitting, etc
Expand Down
2 changes: 1 addition & 1 deletion README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* 🎉 **完善的插件体系**,覆盖从源码到构建产物的每个生命周期
* 🚀 **高性能**,通过插件支持 PWA、以路由为单元的 code splitting 等
* 💈 **支持静态页面导出**,适配各种环境,比如中台业务、无线业务、[egg](https://github.com/eggjs/egg)、支付宝钱包、云凤蝶等
* 🚄 **开发启动快**,支持一键开启 [dll](https://umijs.org/plugin/umi-plugin-react.html#dll) [hard-source-webpack-plugin](https://umijs.org/plugin/umi-plugin-react.html#hardSource)
* 🚄 **开发启动快**,支持一键开启 [dll](https://umijs.org/plugin/umi-plugin-react.html#dll)
* 🐠 **一键兼容到 IE9**,基于 [umi-plugin-polyfills](https://umijs.org/plugin/umi-plugin-react.html#polyfills)
* 🍁 **完善的 TypeScript 支持**,包括 d.ts 定义和 umi test
* 🌴 **与 dva 数据流的深入融合**,支持 duck directory、model 的自动加载、code splitting 等等
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ umi is the basic front-end framework of [Ant Financial](https://www.antfin.com/)
* 🎉 **Complete plugin system**, covering every lifecycle from source code to production
* 🚀 **High performance**, with support for PWA, route-level code splitting, etc. via plugins
* 💈 **Support for static export**, adapt to various environments, such as console app, mobile app, [egg](https://github.com/eggjs/egg), Alipay wallet, etc
* 🚄 **Fast dev startup**, support enable [dll](../plugin/umi-plugin-react.html#dll) and [hard-source-webpack-plugin](../plugin/umi-plugin-react.html#hardSource) with config
* 🚄 **Fast dev startup**, support enable [dll](../plugin/umi-plugin-react.html#dll) with config
* 🐠 **Compatible with IE9**, based on [umi-plugin-polyfills](../plugin/umi-plugin-react.html#polyfills)
* 🍁 **Support TypeScript**, including d.ts definition and `umi test`
* 🌴 **Deep integration with [dva](https://dvajs.com/)**, support duck directory, automatic loading of model, code splitting, etc
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
};
```

For more dll, hardSource, polyfilles, locale, title, etc., refer to [umi-plugin-react documentation](/plugin/umi-plugin-react.html).
For more dll, polyfilles, locale, title, etc., refer to [umi-plugin-react documentation](/plugin/umi-plugin-react.html).

### webpackrc.js

Expand Down
5 changes: 1 addition & 4 deletions docs/plugin/umi-plugin-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default {
dll: {
exclude: [],
},
hardSource: true,
pwa: true,
hd: true,
fastClick: true,
Expand Down Expand Up @@ -141,9 +140,7 @@ options include:

### hardSource

* Type: `Boolean`

Open webpack cache with [hard-source-webpack-plugin](https://github.com/mzgoddard/hard-source-webpack-plugin), 80% increase in speed of the second start. It is recommended to use non-windows computers. Due to the slowness of large file IO under Windows, it is up to you to decide whether to enable it.
[hardSource] is no longer valid. Please remove it from the configuration file.

### pwa

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ umi 是蚂蚁金服的底层前端框架,已直接或间接地服务了 600+
* 🎉 **完善的插件体系**,覆盖从源码到构建产物的每个生命周期
* 🚀 **高性能**,通过插件支持 PWA、以路由为单元的 code splitting 等
* 💈 **支持静态页面导出**,适配各种环境,比如中台业务、无线业务、[egg](https://github.com/eggjs/egg)、支付宝钱包、云凤蝶等
* 🚄 **开发启动快**,支持一键开启 [dll](../plugin/umi-plugin-react.html#dll) [hard-source-webpack-plugin](../plugin/umi-plugin-react.html#hardSource)
* 🚄 **开发启动快**,支持一键开启 [dll](../plugin/umi-plugin-react.html#dll)
* 🐠 **一键兼容到 IE9**,基于 [umi-plugin-polyfills](../plugin/umi-plugin-react.html#polyfills)
* 🍁 **完善的 TypeScript 支持**,包括 d.ts 定义和 umi test
* 🌴 **[dva](https://dvajs.com/) 数据流的深入融合**,支持 duck directory、model 的自动加载、code splitting 等等
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
};
```

更多 dll、hardSource、polyfilles、locale、title 等,参考 [umi-plugin-react 文档](/zh/plugin/umi-plugin-react.html)
更多 dll、polyfilles、locale、title 等,参考 [umi-plugin-react 文档](/zh/plugin/umi-plugin-react.html)

### webpackrc.js

Expand Down
5 changes: 1 addition & 4 deletions docs/zh/plugin/umi-plugin-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default {
dll: {
exclude: [],
},
hardSource: true,
pwa: true,
hd: true,
fastClick: true,
Expand Down Expand Up @@ -154,9 +153,7 @@ export default {

### hardSource

* 类型:`Boolean`

通过 [hard-source-webpack-plugin](https://github.com/mzgoddard/hard-source-webpack-plugin) 开启 webpack 缓存,二次启动时间减少 80%。推荐非 windows 电脑使用,windows 下由于大文件 IO 比较慢,可自行决定是否启用。
hardSource 已经不可用,请在配置文件中移除它。

### pwa

Expand Down
1 change: 0 additions & 1 deletion packages/af-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"file-loader": "2.0.0",
"fork-ts-checker-webpack-plugin": "0.5.2",
"friendly-errors-webpack-plugin": "1.7.0",
"hard-source-webpack-plugin": "0.13.1",
"inquirer": "6.2.2",
"is-plain-object": "2.0.4",
"is-root": "2.0.0",
Expand Down
17 changes: 0 additions & 17 deletions packages/af-webpack/src/getConfig/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,4 @@ export default function(webpackConfig, opts) {
webpackConfig.when(!!opts.devServer, webpackConfig =>
webpackConfig.merge({ devServer: opts.devServer }),
);

if (process.env.HARD_SOURCE) {
const pkgPath = join(opts.cwd, 'package.json');
if (!existsSync(pkgPath)) {
writeFileSync(pkgPath, '{}', 'utf-8');
}
webpackConfig
.plugin('hard-source')
.use(require('hard-source-webpack-plugin'),[{
environmentHash: {
root: process.cwd(),
directories: ['config'],
files: ['package-lock.json', 'yarn.lock', '.umirc.js', '.umirc.local.js'],
},
},
]);
}
}
9 changes: 4 additions & 5 deletions packages/umi-plugin-react/src/plugins/hardSource.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export default function() {
// 允许用户通过环境变量覆盖配置
if (!('HARD_SOURCE' in process.env)) {
process.env.HARD_SOURCE = true;
}
export default function(api) {
api.log.error(
'[hardSource] is no longer valid. Please remove it from the configuration file.',
);
}
1 change: 0 additions & 1 deletion packages/umi-plugin-react/test/normal/.umirc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default {

// dev boost
dll: false,
hardSource: false,

// performace
pwa: {},
Expand Down
1 change: 0 additions & 1 deletion packages/umi-plugin-react/test/pwa/.umirc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default {
routes: {
exclude: [],
},
hardSource: false,
pwa: {
// manifestOptions: {
// srcPath: join(__dirname, 'pages/manifest.json')
Expand Down

0 comments on commit 1a89937

Please sign in to comment.