Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Jan 9, 2018
1 parent 7fe7639 commit 9a8ea3f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/umi-build-dev/src/getRouterContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function getRouteComponents(routeConfig, config = {}, paths) {
const { loading } = config;
let loadingOpts = '';
if (loading) {
loadingOpts = `loading: require('${join(paths.cwd, loading)}').default,`;
loadingOpts = `, loading: require('${join(paths.cwd, loading)}').default,`;
}

const routerComponents = Object.keys(routeConfig).map(key => {
Expand All @@ -46,9 +46,13 @@ function getRouteComponents(routeConfig, config = {}, paths) {
: '() => <div>Compiling...</div>';
return ` <Route exact path="${key}" component={${component}}></Route>`;
} else {
return ` <Route exact path="${key}" component={dynamic(() => import(/* webpackChunkName: '${normalizeEntry(
return ` <Route exact path="${
key
}" component={dynamic(() => import(/* webpackChunkName: '${normalizeEntry(
routeConfig[key],
)}' */'${pageJSFile}'), { callback: (err) => callback('${key}', err), ${loadingOpts} }) }></Route>`;
)}' */'${pageJSFile}'), { callback: (err) => callback('${key}', err)${
loadingOpts
} }) }></Route>`;
}
});

Expand Down

0 comments on commit 9a8ea3f

Please sign in to comment.