Dynamic imports are great, but I’m not 100% clear on how they work exactly.
For example, at least when testing locally it seems like dynamically imported files are still getting bundled and executed. For example if I create a new test.js file containing:
console.log('test')
And then import it normally from somewhere else (import 'test.js) I would expect test to get logged out.
But when it comes to dynamic imports, test is still getting logged out even if I use import('test.js') instead. I would’ve thought this would return a Promise, and that the test.js code would not get executed until I call then() on that Promise?
What’s the expected behavior here? How can I ensure test won’t get logged out until a later time?
I did think about only passing the path (./Admin.jsx, or its absolute equivalent) to addRoute and then only calling import() later on when I actually need it, but I then end up running into Cannot find module issues, probably due to a wrong path…