Skip to content

Commit

Permalink
feat: add test and docs for umi webpack in production (#5920)
Browse files Browse the repository at this point in the history
* feat: add test and docs for umi webpack in production

* feat: add test and docs for umi webpack in production

* feat: add test and docs for umi webpack in production

Co-authored-by: 纪颖志 <jiyingzhi@black-unique.com>
  • Loading branch information
jiyingzhi and 纪颖志 committed Jan 5, 2021
1 parent 67fd2e0 commit 3a9a1dc
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/docs/cli.md
Expand Up @@ -236,3 +236,13 @@ MiniCssExtractPlugin {
}
}
```

默认会打印 development 的配置,如需查看 production 配置,需要指定环境变量:

```bash
$ NODE_ENV=production umi webpack

{
mode: 'production'
}
```
10 changes: 10 additions & 0 deletions docs/docs/cli.zh-CN.md
Expand Up @@ -231,3 +231,13 @@ MiniCssExtractPlugin {
}
}
```

默认会打印 development 的配置,如需查看 production 配置,需要指定环境变量:

```bash
$ NODE_ENV=production umi webpack

{
mode: 'production'
}
```
Expand Up @@ -20,6 +20,40 @@ test('webpack', async () => {
expect(config.mode).toEqual('development');
});

test('webpack in production', async () => {
const cwd = join(fixtures, 'webpack');
const service = new Service({
cwd,
env: 'production',
presets: [require.resolve('../../../index.ts')],
});
const config = await service.run({
name: 'webpack',
args: {
print: false,
},
});
// @ts-ignore
expect(config.mode).toEqual('production');
});

test('webpack in test', async () => {
const cwd = join(fixtures, 'webpack');
const service = new Service({
cwd,
env: 'test',
presets: [require.resolve('../../../index.ts')],
});
const config = await service.run({
name: 'webpack',
args: {
print: false,
},
});
// @ts-ignore
expect(config.mode).toEqual('development');
});

test('webpack with plugins', async () => {
const cwd = join(fixtures, 'webpack');
const service = new Service({
Expand Down

0 comments on commit 3a9a1dc

Please sign in to comment.