The problem of dynamic introduction of vue File by webpack

I judge which vue component needs to be introduced according to the parameters passed to me by the backend, that is, I won"t know which vue file I need and load it until webpack has been packaged. The problem now is.
I used Vue.component (this.style, () = > import (`themes/$ {this.style} .vue`)) this.style is the parameter passed from the backend. After I do this, webpack will package all the vue files under my themes folder into a file, for example, now there are a.vue and b.vue under the themes folder, and the code of these two vue files is included in the js file generated on the packaged page, but my this.style parameter is a.vue at this time.
so how can you package only the vue file that my dynamic parameters passed?

Aug.14,2021

can this be packaged? it is not packaged and uploaded to the server. And then you can pack it when the user visits it? I don't think so


when packing this.style there is no definition, try if else instead


see, use require.ensure (dependent, fn, alias)


can you explain how to do it specifically? I happen to have a similar problem. I want to package the components in Project A to the server, obtain them dynamically after release in Project B, and display them as components

.
Menu