question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing via import/export "pass-through" causes randomly undefined variables (TypeScript)

See original GitHub issue

Version

3.0.0

Reproduction link

https://github.com/ffxsam/repro-undefined-import

Node and OS info

yarn 1.9.4, Ubuntu 18.04

Steps to reproduce

  1. Clone and run yarn
  2. yarn serve
  3. Open Chrome console, note that routes is undefined

What is expected?

routes should be an array of routes

What is actually happening?

routes is undefined


Of note is this line in the code: https://github.com/ffxsam/repro-undefined-import/blob/master/src/components/LoginForm.vue#L100

Edit that and replace routeNames.DASHBOARD with any arbitrary string, and save. Now you’ll see that routes in the console is an array. Also updating the import to the following will fix it:

import { routeNames } from '../router/route-names';

This is very strange and took me hours to track down. It may or may not be a vue-cli issue, but I figured this was a good starting point. Sorry I don’t have a more descriptive issue report, but it’s so random, I’m not even sure how to describe it.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
sodateacommented, Aug 18, 2018
0reactions
ffxsamcommented, Aug 19, 2018

That’s the tough thing here, determining where the issue actually lies (webpack? TypeScript?). I don’t think there’s an immediate solution for this, so I’ll have to remain conscious of imports/re-exports.

Thanks for your help!

PS: Made the repo private, there was a bit more code in there that was I comfortable with. Not that there was anything terribly proprietary, but still. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Persistent undefined error in typescript import export
Whatever I do, whatever object I try export (class, function, const) with or without using a module: I get the same error. Maybe...
Read more >
Modern JavaScript – Imports, Exports, Let, Const, and ...
When we declare a variable using the let keyword, we can assign a new value to that variable later but we cannot re-declare...
Read more >
Cytoscape.js
js : A non-minified ESM ( import / export ) build without any bundled dependencies. This is intended to be consumed automatically by...
Read more >
typescript-cheatsheet - GitHub Pages
In TypeScript, both undefined and null actually have their own types named ... Importing an exported declaration is done through using the import...
Read more >
12.2.1 SOA Known Issues Page - Oracle
Oracle BPEL PM supports the use of variables with same names across ... This section lists all the known issues/limitations related to Import/Export....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found