I am trying to do a dynamic import

Hi all! I am trying to do a dynamic import so that my classes are pulled by information from json. In json, I only have popup classes specified that I need to get inside the game. I make an import and put the values ​​into an array, so that I can later put them in the game config. But as a result, I only get the value of the first import, the rest is undefined. Tell me how to correctly perform dynamic imports inside a loop, or is there a fundamentally different approach altogether?

вот мой код с импортом:

var popupsConfig = myConfig.popups
console.log(popupsConfig)
var popups = []

async function getPopups(popupsConfig) {
    for (let i = 0; i < popupsConfig.length; i++) {
        let obj = await 
        import (`../src/assets/popups/${myConfig.popups[i].popupType}`)
        popups[i] = obj.default
            //popups.push(obj.default)
    }
}
getPopups(popupsConfig)

Hey there,

I never saw an import statement inside a function call. Maybe you could use require() instead?

let obj = require(`../src/assets/popups/${myConfig.popups[i].popupType}`)

Best regards
Nick

Here an example using webpack:

I doubt you need dynamic imports in this case.