Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(umi-build-dev): disable mock via MOCK=none #491

Merged
merged 3 commits into from
May 17, 2018
Merged

feat(umi-build-dev): disable mock via MOCK=none #491

merged 3 commits into from
May 17, 2018

Conversation

xiaohuoni
Copy link
Member

$ MOCK=none umi dev
Respond #486

$ MOCK=none umi dev
@sorrycc
Copy link
Member

sorrycc commented May 17, 2018

应该改在 packages/umi-build-dev/src/getPlugins.js

@coveralls
Copy link

coveralls commented May 17, 2018

Pull Request Test Coverage Report for Build 436

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.4%) to 20.686%

Files with Coverage Reduction New Missed Lines %
packages/umi-build-dev/src/getPlugins.js 1 0.0%
packages/umi-plugin-dva/src/index.js 3 27.39%
Totals Coverage Status
Change from base Build 430: 0.4%
Covered Lines: 462
Relevant Lines: 2470

💛 - Coveralls

@xiaohuoni
Copy link
Member Author

改成这样,感觉怪怪的

const builtInPlugins = [
    './plugins/output-path',
    './plugins/global-js',
    './plugins/global-css',
    './plugins/antd',
    './plugins/fastclick',
    './plugins/hd',
    './plugins/hash-history',
    './plugins/afwebpack-config',
    './plugins/404', // 404 must after mock
  ];
  if(MOCK){
    builtInPlugins.push('./plugins/mock')
  }

@sorrycc
Copy link
Member

sorrycc commented May 17, 2018

mock 有顺序关系的,不能换位置,应该这样:

- './plugins/mock',
+ ...(process.env.MOCK === 'none' ? [] : ['./plugins/mock']),

@sorrycc sorrycc merged commit 3ae5517 into umijs:master May 17, 2018
@sorrycc sorrycc changed the title can be closed mock feat(umi-build-dev): disable mock via MOCK=none May 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants