-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from umijs/improve-umi
Improve umi
- Loading branch information
Showing
11 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('global'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
}, | ||
{ | ||
"path": "/list", | ||
"exact": true, | ||
"component": "./pages/b" | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/af-webpack/src/getUserConfig/configs/urlLoaderExcludes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import assert from 'assert'; | ||
|
||
export default function() { | ||
return { | ||
name: 'urlLoaderExcludes', | ||
validate(val) { | ||
assert( | ||
Array.isArray(val), | ||
`The urlLoaderExcludes config must be Array, but got ${val}`, | ||
); | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { join } from 'path'; | ||
import { existsSync } from 'fs'; | ||
|
||
export default function(api) { | ||
const { paths } = api.service; | ||
|
||
const globalFiles = [ | ||
join(paths.absSrcPath, 'global.tsx'), | ||
join(paths.absSrcPath, 'global.ts'), | ||
join(paths.absSrcPath, 'global.jsx'), | ||
join(paths.absSrcPath, 'global.js'), | ||
]; | ||
|
||
function getGlobalJS() { | ||
for (const file of globalFiles) { | ||
if (existsSync(file)) { | ||
return file; | ||
} | ||
} | ||
} | ||
|
||
api.register('modifyEntryFile', ({ memo }) => { | ||
const globalJS = getGlobalJS(); | ||
if (globalJS) { | ||
memo = `import '${globalJS}';\r\n${memo}`; | ||
} | ||
return memo; | ||
}); | ||
|
||
api.register('modifyPageWatchers', ({ memo }) => { | ||
return [...memo, ...globalFiles]; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters