1

Does the ES6 module syntax allow you to import something from a folder?

For example if I have ./sub/main.js and I try import foo from './sub in the ./main.js file, will this work?

Could I get this sort of importing from a folder to work with babel and webpack?

Basically this would be the equivalent of __init__.py in Python.

saul.shanabrook
  • 3,068
  • 3
  • 31
  • 49

1 Answers1

2

ES6's module syntax does not dictate how the module identifier should be interpreted.

That solely depends on the module loader / bundler you are using, which seems to be webpack. Not sure how easily it can be implemented, have a look at the documentation.

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143