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
  • 2,716
  • 2
  • 28
  • 44

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
  • 705,106
  • 160
  • 1,004
  • 1,072