0

When using ES6 module loading syntax, like so...

import LoginPage from '../../pages/login';

... is it possible to use a function to replace ../../pages with a function so that I could have something like this...

import LoginPage from page_path('login');

This line is repeated for all pages I am importing, so if it is in a function I can update all paths quickly if my file structure were to change.

Trying it out, it would seem it doesn't work. Is there a smarter way to do this in ES6?

Thanks :)

Jonathon Blok
  • 749
  • 4
  • 14

0 Answers0