Skip to content

Commit 383b281

Browse files
authored
Merge pull request #141 from pengfeiWang/umiNameToLibraryName
entry.js.tpl 中使用 umi libName 的地方用<%= libraryName %>占位符替换处理
2 parents 2f688a6 + 35e7873 commit 383b281

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/umi-build-dev/src/FilesGenerator.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default class FilesGenerator {
102102
}
103103

104104
generateFiles() {
105-
const { paths, entryJSTpl, config } = this.service;
105+
const { paths, entryJSTpl, config, libraryName } = this.service;
106106
this.service.applyPlugins('generateFiles');
107107

108108
this.generateRouterJS();
@@ -119,6 +119,7 @@ export default class FilesGenerator {
119119
entryContent = entryContent
120120
.replace(PLACEHOLDER_IMPORT, '')
121121
.replace(PLACEHOLDER_HISTORY_MODIFIER, '')
122+
.replace(/<%= libraryName %>/g, libraryName)
122123
.replace(
123124
PLACEHOLDER_RENDER,
124125
`ReactDOM.render(React.createElement(require('./router').default), document.getElementById('root'));`,

packages/umi-build-dev/template/entry.js.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import createHistory from 'umi/_createHistory';
3+
import createHistory from '<%= libraryName %>/_createHistory';
44
<%= IMPORT %>
55

66
// create history

0 commit comments

Comments
 (0)