{"action":"created","issue":{"url":"https://api.github.com/repos/umijs/umi/issues/160","repository_url":"https://api.github.com/repos/umijs/umi","labels_url":"https://api.github.com/repos/umijs/umi/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/umijs/umi/issues/160/comments","events_url":"https://api.github.com/repos/umijs/umi/issues/160/events","html_url":"https://github.com/umijs/umi/issues/160","id":302166914,"number":160,"title":"__router.json 配置没有加 exact 选项，但是在生成后的router.js里面有这个exact","user":{"login":"smithyj","id":9820142,"avatar_url":"https://avatars2.githubusercontent.com/u/9820142?v=4","gravatar_id":"","url":"https://api.github.com/users/smithyj","html_url":"https://github.com/smithyj","followers_url":"https://api.github.com/users/smithyj/followers","following_url":"https://api.github.com/users/smithyj/following{/other_user}","gists_url":"https://api.github.com/users/smithyj/gists{/gist_id}","starred_url":"https://api.github.com/users/smithyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smithyj/subscriptions","organizations_url":"https://api.github.com/users/smithyj/orgs","repos_url":"https://api.github.com/users/smithyj/repos","events_url":"https://api.github.com/users/smithyj/events{/privacy}","received_events_url":"https://api.github.com/users/smithyj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-05T04:17:33Z","updated_at":"2018-03-05T04:48:42Z","closed_at":null,"author_association":"NONE","body":"__router.json 配置没有加 exact 选项，但是在生成后的router.js里面有这个exact\r\n复现项目地址：http://github.com/smithyj/umi.yangyj.com"},"comment":{"url":"https://api.github.com/repos/umijs/umi/issues/comments/370308873","html_url":"https://github.com/umijs/umi/issues/160#issuecomment-370308873","issue_url":"https://api.github.com/repos/umijs/umi/issues/160","id":370308873,"user":{"login":"smithyj","id":9820142,"avatar_url":"https://avatars2.githubusercontent.com/u/9820142?v=4","gravatar_id":"","url":"https://api.github.com/users/smithyj","html_url":"https://github.com/smithyj","followers_url":"https://api.github.com/users/smithyj/followers","following_url":"https://api.github.com/users/smithyj/following{/other_user}","gists_url":"https://api.github.com/users/smithyj/gists{/gist_id}","starred_url":"https://api.github.com/users/smithyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smithyj/subscriptions","organizations_url":"https://api.github.com/users/smithyj/orgs","repos_url":"https://api.github.com/users/smithyj/repos","events_url":"https://api.github.com/users/smithyj/events{/privacy}","received_events_url":"https://api.github.com/users/smithyj/received_events","type":"User","site_admin":false},"created_at":"2018-03-05T04:48:41Z","updated_at":"2018-03-05T04:48:41Z","author_association":"NONE","body":"@sorrycc \r\n`\r\n getRouterContent() {\r\n    const { routes, config, paths } = this.service;\r\n\r\n    const routesByPath = routes.reduce((memo, { path, component }) => {\r\n      memo[path] = component;\r\n      return memo;\r\n    }, {});\r\n\r\n    // 导出静态文件时，匹配 /index.html 到 /\r\n    if (config.exportStatic && routesByPath['/']) {\r\n      routesByPath['/index.html'] = routesByPath['/'];\r\n    }\r\n\r\n    const { loading } = config;\r\n    let loadingOpts = '';\r\n    if (loading) {\r\n      loadingOpts = `loading: require('${winPath(\r\n        join(paths.cwd, loading),\r\n      )}').default,`;\r\n    }\r\n    let routesContent = Object.keys(routesByPath).map(key => {\r\n      const pageJSFile = winPath(relative(paths.tmpDirPath, routesByPath[key]));\r\n      debug(`requested: ${JSON.stringify(getRequest())}`);\r\n      const isDev = process.env.NODE_ENV === 'development';\r\n\r\n      let component;\r\n      let isCompiling = false;\r\n      let webpackChunkName = null;\r\n      const compilingPath = winPath(join(__dirname, 'Compiling.js'));\r\n      if (isDev && process.env.COMPILE_ON_DEMAND !== 'none') {\r\n        if (getRequest()[key]) {\r\n          component = `require('${pageJSFile}').default`;\r\n        } else {\r\n          component = `() => React.createElement(require('${compilingPath}').default, { route: '${key}' })`;\r\n          isCompiling = true;\r\n        }\r\n      } else {\r\n        webpackChunkName = normalizeEntry(routesByPath[key]);\r\n        component = `dynamic(() => import(/* webpackChunkName: '${webpackChunkName}' */'${pageJSFile}'), { ${loadingOpts} })`;\r\n      }\r\n      component = this.service.applyPlugins('modifyRouteComponent', {\r\n        initialValue: component,\r\n        args: {\r\n          isCompiling,\r\n          pageJSFile,\r\n          webpackChunkName,\r\n          config,\r\n        },\r\n      });\r\n\r\n      return `    <Route exact path=\"${key}\" component={${component}} />`;\r\n    });\r\n`"}}
{"actor":{"display_login":"smithyj"}}