Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

270
Views
Wildcard imports with `as` in JavaScript

I am primarily a JavaScript developer, but with some recent exposure to Java, I rather enjoy how Java handles wildcard imports. Without using any as statements, the import takes all named imports and imports them directly into the current namespace/scope as variables/classes without any need for there to be one variable they are properties of.

Is this possible in JavaScript. For example, if I make this export:

Export Example

export const a = 1;
export const b = 2;
export const c = 3;
export default const d = 4;

Then this would be true of related imports:

Wildcard Imports Example

import * as Foo from "./file.js";

Foo.a // -> 1
Foo.b // -> 2
Foo.c // -> 3
Foo.d // -> 4

Default Import Example

import Foo from "./file.js";

Foo // -> 4

Specific/Named Imports Example

import { a, b } from "./file.js";

a // -> 1
b // -> 2
c // -> undefined
d // -> undefined

What I am looking for, which it appears Java supports, is the ability to do something like the current JavaScript wildcard import, but without the as statement, like the below example, where all named exports are imported as fully accessible variables within the current namespace/scope:

Wildcard Imports (without as) Example - DESIRED

import * from "./file.js";

a // -> 1
b // -> 2
c // -> 3
d // -> 4

Is this possible?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!