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

Router (goto, invalidate etc.) not working in production #3269

Closed
pixelmund opened this issue Jan 9, 2022 · 0 comments · Fixed by #3374
Closed

Router (goto, invalidate etc.) not working in production #3269

pixelmund opened this issue Jan 9, 2022 · 0 comments · Fixed by #3374
Labels
p3-edge-case SvelteKit cannot be used in an uncommon way router

Comments

@pixelmund
Copy link
Contributor

pixelmund commented Jan 9, 2022

Describe the bug

I noticed that the router (goto, invalidate etc.) doesn't seems to me work, upon reaching a reasonable size.
The singletons module gets bundled inside vendor.js and so the router is set to undefined before the init function is invoked.

/// vendor-c70aba79.js
let router$1;
function init(opts) {
  router$1 = opts.router;
}
/// ....
const router = router$1;
const goto = goto_;
const invalidate = invalidate_;
async function goto_(href, opts) {
  return router.goto(href, opts, []);
}

vendor-c70aba79.js:1117 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'goto') at goto_ (vendor-c70aba79.js:1117) at HTMLButtonElement.click_handler (index.svelte-8e9d7a38.js:401)

Reproduction

https://github.com/pixelmund/kit-router-not-working

Steps to reproduce:

  • pnpm install
  • pnpm build
  • pnpm start
  • Click on the doesn't work button and view error logs

Logs

vendor-c70aba79.js:1117 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'goto')
    at goto_ (vendor-c70aba79.js:1117)
    at HTMLButtonElement.click_handler (index.svelte-8e9d7a38.js:401)
goto_ @ vendor-c70aba79.js:1117
click_handler @ index.svelte-8e9d7a38.js:401

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 23.29 GB / 31.93 GB
  Binaries:
    Node: 16.2.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.1.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (97.0.1072.55)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.10
    @sveltejs/adapter-node: ^1.0.0-next.60 => 1.0.0-next.60
    @sveltejs/kit: next => 1.0.0-next.218
    svelte: ^3.44.0 => 3.45.0

Severity

blocking all usage of SvelteKit

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-edge-case SvelteKit cannot be used in an uncommon way router
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants