Reputation: 35
I'm having an issue while trying to import all files in one of my directories.
This works:
import '../pages/guidance/target_access_client_relationships.js';
While this doesn't:
import '../pages/guidance';
What am I doing wrong? I am planning to have quite a lot of files in 'guidance' and I'd rather not have to import every single file individually.
Thanks!
Upvotes: 2
Views: 1075
Reputation: 5929
The only way I know is to use a index.js
and import all the file inside it.
EX:
dir A index.js
import './fileA.js'
import './fileB.js'
dir B index.js
import './fileA.js'
import './fileB.js'
and finally you can make a parent dir and import both
parent dir index.js
import './dirB'
import './dirA'
Upvotes: 3
Reputation: 633
This is not possible I don't think, but what you can do is this...
Create in the directory a index.js file which imports everything from the directory and exports it.
import modules from files in directory has a similar answer.
Upvotes: 1