Skip to content

Commit

Permalink
feat: warn if BABEL_POLYFILL is set to none (umijs#1844)
Browse files Browse the repository at this point in the history
* feat: warn user if BABEL_POLYFILL is set to none

* chore: don't test 11
  • Loading branch information
sorrycc authored Jan 15, 2019
1 parent 5516d5f commit 2cd23c5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: node_js
node_js:
- "8"
- "10"
- "11"

before_script:
- npm run build
Expand Down
2 changes: 0 additions & 2 deletions docs/guide/env-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ ANALYZE server port, default 8888.

### BABEL_POLYFILL <Badge text="2.2.0+"/>

默认引入 `@babel/polyfill`,值为 none 时不引入。比如:

`@babel/polyfill` is included by default, set the value to `none` if you don't want it.

e.g.
Expand Down
2 changes: 1 addition & 1 deletion docs/plugin/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ api.log.pending('Write release notes for %s', '1.2.0');
api.log.watch('Recursively watching build directory...');
```

Output various types of logs.
Output various [types](https://github.com/klaussinani/signale/blob/94984998a0e9cb280e68959ddd9db70b49713738/types.js#L4) of logs.

### winPath

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugin/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ api.log.pending('Write release notes for %s', '1.2.0');
api.log.watch('Recursively watching build directory...');
```

输出各类日志
输出[各种类型](https://github.com/klaussinani/signale/blob/94984998a0e9cb280e68959ddd9db70b49713738/types.js#L4)的日志

### winPath

Expand Down
10 changes: 9 additions & 1 deletion packages/umi-build-dev/src/plugins/targets.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { join, relative } from 'path';
import { readFileSync } from 'fs';
import chalk from 'chalk';
import { isPlainObject } from 'lodash';
import assert from 'assert';

export default function(api) {
const { paths, winPath } = api;
const { paths, winPath, log } = api;

api._registerConfig(() => {
return () => {
Expand Down Expand Up @@ -53,6 +54,13 @@ export default function(api) {
},
];
} else {
log.warn(
chalk.yellow(
`Since you have configured the environment variable ${chalk.bold(
'BABEL_POLYFILL',
)} to none, no patches will be included.`,
),
);
return [];
}
});
Expand Down

0 comments on commit 2cd23c5

Please sign in to comment.