nested dynamic imports aint workin!
error: Uncaught ReferenceError: x is not defined
b.x.uniq;
^
at file:///Users/cdaringe/src/deno-nested-dynamic-import/a.ts:2:3
repro:
deno run -A a.tshere are the tiny files for minimum repro:
// a.ts
const b = await import("./b.ts");
b.x.uniq;
// b.ts - broken
const uniq = await import("https://deno.land/x/lodash/uniq.js").then((mod) =>
mod.default
);
export const x = { uniq };
// b.ts - ok
export const x = { uniq: 'this is fine' };
npx envinfo
System:
OS: macOS 10.15.3
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 497.97 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.8.0 - ~/.nvm/versions/node/v13.8.0/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.13.6 - ~/.nvm/versions/node/v13.8.0/bin/npm
Managers:
Cargo: 1.42.0 - ~/.cargo/bin/cargo
Homebrew: 2.2.15 - /usr/local/bin/brew
pip2: 9.0.1 - ~/.asdf/shims/pip2
RubyGems: 3.0.3 - /usr/bin/gem
Utilities:
CMake: 3.13.0 - /usr/local/bin/cmake
Make: 3.81 - /usr/bin/make
GCC: 4.2.1 - /usr/bin/gcc
Git: 2.19.0 - /usr/local/bin/git
Clang: 1100.0.33.12 - /usr/bin/clang
Subversion: 1.10.4 - /usr/bin/svn
FFmpeg: 4.0.2 - /usr/local/bin/ffmpeg
Servers:
Apache: 2.4.41 - /usr/sbin/apachectl
Virtualization:
Docker: 19.03.8 - /usr/local/bin/docker
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Nano: 2.0.6 - /usr/bin/nano
VSCode: 1.45.0 - /usr/local/bin/code
Vim: 8.1 - /usr/bin/vim
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
Languages:
Bash: 5.0.11 - /usr/local/bin/bash
Go: 1.11.1 - /usr/local/bin/go
Elixir: 1.9.1 - /usr/local/bin/elixir
Java: javac 11 - /usr/bin/javac
Perl: 5.18.4 - /usr/bin/perl
PHP: 7.3.11 - /usr/bin/php
Python: 2.7.14 - /Users/cdaringe/.asdf/shims/python
Ruby: 2.6.3 - /usr/bin/ruby
Rust: 1.21.1 - /Users/cdaringe/.cargo/bin/rustup
Databases:
SQLite: 3.28.0 - /usr/bin/sqlite3
Browsers:
Chrome: 81.0.4044.138
Firefox: 73.0.1
Safari: 13.0.5
:| Deno isn't listed ^ yet. deno 1.0.0-rc2
Need to look into how TLA works when exporting from a module according the v8 implementation and the spec.
For context, why are you doing what you are doing instead of:
import uniq from "https://deno.land/x/lodash/uniq.js";
export const x = { uniq };
For context, why are you doing what you are doing instead of:
for example purposes only 馃槃
That's something I stumbled upon, too.
Is that not possible according to the specifications?
I'm not sure yet. I think it is valid, but then I am not sure why it just doesn't work in Deno, as in theory we wouldn't be doing anything special here.
I know this came first, but #7649 is the same issue and there is work afoot to fix it but tied to that issue, so for clarity I am going to close this one.
Most helpful comment
I'm not sure yet. I think it is valid, but then I am not sure why it just doesn't work in Deno, as in theory we wouldn't be doing anything special here.