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.

Production breaks on importing entire module

See original GitHub issue

I am trying to import an entire module which has submodules. When using aleph build or aleph start I get this error in the browser console:

Uncaught (in promise) TypeError: Cannot destructure property 'default' of '(intermediate value)' as it is undefined.
    at deps.bundle.5a8741c5.js:1
    at Generator.next (<anonymous>)
    at e (deps.bundle.5a8741c5.js:1)
    at i (deps.bundle.5a8741c5.js:1)

When using aleph dev the code works as intended.


Example

The import is here (specifically the api part): https://gitlab.com/silk-matrix/silk-desktop/-/blob/aleph-issue-280/src/lib/useLogin.ts#L2

Using this code below has the same effect.

import * as api from "https://x.nest.land/matrix.ts@0.1.9/src/api/mod.ts";

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ijecommented, Apr 17, 2021

alpha.30 can work fine in your example on macos

0reactions
cyclanecommented, Apr 17, 2021

aleph.30 does fix it, not sure why it didn’t work from the master branch yesterday

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modules is missing in production mode · Issue #7499 - GitHub
The problem really seems that it's being imported at all. I've disabled UglifyJsPlugin via the optimization portion of my webpack config: module ......
Read more >
Why is Python running my module when I import it, and how ...
This module would just execute the main function when run, and not execute it if imported. It all depends on what you want...
Read more >
Python import: Advanced Techniques and Tips
Organize imports into groups: first standard library imports, then third-party imports, and finally local application or library imports. Order imports ...
Read more >
Traps for the Unwary in Python's Import System
While Python 3.3+ is able to import the submodule without any problems: ... long list is of all the methods of invocation that...
Read more >
Modules: Packages | Node.js v19.3.0 Documentation
It treats all files that lack .json or .node extensions as JavaScript text ... Imported CommonJS modules have their URLs converted to absolute...
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