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

[1.0] loader.js fetchResource - cannot read property #1179

Closed
mericsson opened this issue Jun 15, 2017 · 1 comment
Closed

[1.0] loader.js fetchResource - cannot read property #1179

mericsson opened this issue Jun 15, 2017 · 1 comment

Comments

@mericsson
Copy link
Contributor

mericsson commented Jun 15, 2017

Does this look familiar to anyone? I just resync'ed canary. Gatsby version is: 1.0.0-alpha.22-alpha.18f02e94. It works fine with build and serve targets, but not in develop.

When loading a page in the gatsby app generated via template.

loader.js:82 Uncaught TypeError: Cannot read property 'page-component---src-templates-category-js' of undefined
    at fetchResource (loader.js:82)
    at createResourceDownload (loader.js:38)
    at startResourceDownloading (prefetcher.js:15)
    at prefetcher.js:43

Code in question in browser:

var fetchResource = function fetchResource(resourceName) {
  var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};

  if (resourceStrCache[resourceName]) {
    process.nextTick(function () {
      cb(null, resourceStrCache[resourceName]);
    });
  } else {
    // Find resource
    /* LINE 82 */ var resourceFunction = resourceName.slice(0, 6) === `page-c` ? asyncRequires.components[resourceName] : asyncRequires.json[resourceName];

    // Download the resource
    resourceFunction(function (err, executeChunk) {
      resourceStrCache[resourceName] = executeChunk;
      cb(err, executeChunk);
    });
  }
};

Depending on the page loaded. Error can also look like: Cannot read property 'index.json' of undefined.

The page loads fine but breaks JS and interactivity.

@KyleAMathews
Copy link
Contributor

Yeah, I fixed that a couple of days ago... #1164 I thought I'd released another canary since then. Going to release the first beta in a bit after tests finish in #1177 and I write up the CHANGELOG entry

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

No branches or pull requests

2 participants