1

I know that in JavaScript you can import certain functions from another JavaScript file in this manner without having to specify namespaces:

import {sayHi, sayBye} from './say.js';
sayHi('John'); // Hello, John!
sayBye('John'); // Bye, John!

I also know that you can import every function from another JavaScript file in this manner, but you must specify namespaces.

import * as say from './say.js';    
say.sayHi('John');
say.sayBye('John');

Is it possible to import every function of another JavaScript file without specifying a namespace?

My main aim is to have all my code be aware of all my other code. I am currently doing this by putting everything in one ridiculously long JavaScript file, but ideally I could have things across many files for better organization. I am very careful about creating unique names for things so I don't anticipate any naming clashes.

Thanks, Nakul

Nakul Tiruviluamala
  • 523
  • 1
  • 3
  • 15
  • 1
    No, you can't. Duplicate of: [es6 - import all named module without alias](https://stackoverflow.com/questions/34573779/es6-import-all-named-module-without-alias) – gtsiam Nov 11 '19 at 03:56

0 Answers0