Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'component' of undefined #735

Closed
enahsor opened this issue Jan 4, 2021 · 1 comment · Fixed by #751
Closed

TypeError: Cannot read property 'component' of undefined #735

enahsor opened this issue Jan 4, 2021 · 1 comment · Fixed by #751

Comments

@enahsor
Copy link

enahsor commented Jan 4, 2021

After deciding to make my first PR to this repo, I've come across this error. I've only followed the instructions outlined in the readme.

System:

  • Windows 10

Steps to reproduce:

  1. Clone repo
  2. npm install
  3. npm start
  4. Paste path into browser

Trace:

Module../README.md
./README.md:12
   9 | import Previewer from 'dumi-theme-default/src/builtins/Previewer.tsx';
  10 | import SourceCode from 'dumi-theme-default/src/builtins/SourceCode.tsx';
  11 | 
> 12 |     const DumiDemo1 = React.memo(require('@@/dumi/demos').default['slider-demo'].component);
  13 | 
  14 |     export default function () {
  15 |       return (
View compiled
__webpack_require__
./webpack/bootstrap:789
  786 | };
  787 | 
  788 | // Execute the module function
> 789 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  790 | 
  791 | // Flag the module as loaded
  792 | module.l = true;
View compiled
fn
./webpack/bootstrap:100
   97 | 		);
   98 | 		hotCurrentParents = [];
   99 | 	}
> 100 | 	return __webpack_require__(request);
      | ^  101 | };
  102 | var ObjectFactory = function ObjectFactory(name) {
  103 | 	return {
View compiled
getRoutes
./src/.umi/core/routes.ts:47
  44 | "routes": [
  45 |   {
  46 |     "path": "/",
> 47 |     "component": require('C:/Users/drobinson/Desktop/OS/slider/README.md').default,
     | ^  48 |     "exact": true,
  49 |     "meta": {
  50 |       "locale": "en-US",
View compiled
initialValue
./src/.umi/umi.ts:22
  19 | key: 'modifyClientRenderOpts',
  20 | type: ApplyPluginsType.modify,
  21 | initialValue: {
> 22 |   routes: args.routes || getRoutes(),
     | ^  23 |   plugin,
  24 |   history: createHistory(args.hot),
  25 |   isServer: process.env.__IS_SERVER,
View compiled
(anonymous function)
./node_modules/@umijs/runtime/dist/index.esm.js:422
Module../src/.umi/umi.ts
./src/.umi/umi.ts:36
  33 | });
  34 | 
  35 | const clientRender = getClientRender();
> 36 | export default clientRender();
  37 | 
  38 | 
  39 |     window.g_umi = {
View compiled
__webpack_require__
./webpack/bootstrap:789
  786 | };
  787 | 
  788 | // Execute the module function
> 789 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  790 | 
  791 | // Flag the module as loaded
  792 | module.l = true;
View compiled
fn
./webpack/bootstrap:100
   97 | 		);
   98 | 		hotCurrentParents = [];
   99 | 	}
> 100 | 	return __webpack_require__(request);
      | ^  101 | };
  102 | var ObjectFactory = function ObjectFactory(name) {
  103 | 	return {
View compiled
0
http://localhost:8000/umi.js:84770:18
__webpack_require__
./webpack/bootstrap:789
  786 | };
  787 | 
  788 | // Execute the module function
> 789 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  790 | 
  791 | // Flag the module as loaded
  792 | module.l = true;
View compiled
(anonymous function)
./webpack/bootstrap:856
  853 | 
  854 | 
  855 | // Load entry module and return exports
> 856 | return hotCreateRequire(0)(__webpack_require__.s = 0);
      | ^  857 | 
View compiled
(anonymous function)
http://localhost:8000/umi.js:860:10
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.  Click the 'X' or hit ESC to
@shijiatongxue
Copy link

same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants