Based on the typeDefs, you can pass a function, Phaser.Scene or Phaser.Scenes.Settings.Config as the second parameter. Although I do not have any idea how it would work by passing only the config.
The code below will import, add and start the mainScene dynamically.
create() {
let someCondition = true
if (someCondition)
import(/* webpackChunkName: "mainScene" */ './mainScene').then(mainScene => {
this.scene.add('MainScene', mainScene.default, true)
})
else console.log('The mainScene class will not even be loaded by the browser')
}