Skip to content

Commit

Permalink
fix: addUmiExports error in hmr (#2417)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc authored May 14, 2019
1 parent 6ed5ecf commit 0d1e862
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/umi-build-dev/src/plugins/importFromUmi.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const reserveExportsNames = [
'withRouter',
'Route',
]; // reserve name
const umiExportsHook = {}; // repeated definition
let umiExportsHook = {}; // repeated definition

export function cleanCache() {
umiExportsHook = {};
}

export function generateExports(item) {
assert(item.source, 'source should be supplied.');
Expand Down Expand Up @@ -63,6 +67,7 @@ export default function(api) {
});

const generateUmiExports = () => {
cleanCache();
const umiExports = api
.applyPlugins('addUmiExports', {
initialValue: [],
Expand Down
1 change: 1 addition & 0 deletions packages/umi-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ export interface IApi {
* https://umijs.org/plugin/develop.html#application-class-api
*/
modifyDefaultConfig: IModify<object>;
addUmiExports: IAdd<object>;
addPageWatcher: IAdd<string>;
addHTMLMeta: IAdd<object, { route?: IRoute }>;
addHTMLLink: IAdd<object, { route?: IRoute }>;
Expand Down

0 comments on commit 0d1e862

Please sign in to comment.