Vue.js vue插件安装方法中的动态导入

Vue.js vue插件安装方法中的动态导入,vue.js,quasar,Vue.js,Quasar,嗨,我正在尝试使我的插件UI框架不可知。为了做到这一点,我想有一个动态导入的基础上,框架是选定的。这就是我的插件的外观: import Field from './ScanField.vue' export default { install: (Vue, { field = 'ScanField', framework = 'vuetify' } = {}) => { const { components, globals } = require('@/input-comp

嗨,我正在尝试使我的插件UI框架不可知。为了做到这一点,我想有一个动态导入的基础上,框架是选定的。这就是我的插件的外观:

import Field from './ScanField.vue'

export default {
  install: (Vue, { field = 'ScanField', framework = 'vuetify' } = {}) => {
    const { components, globals } = require('@/input-components/' + framework)

    Vue.prototype.$scanField = {
      framework,
      ...globals
    }

    Field.components = { ...Field.components, ...components }
    Vue.component(field, Field)
  }
}
但当我尝试此操作时,会出现以下错误:

[Quasar] boot error: Error: Dynamic requires are not currently supported by @rollup/plugin-commonjs
这是合乎逻辑的,因为您无法在浏览器中进行导入。但是如果我想在构建时导入(例如),该怎么办呢。我怎样才能做到这一点?或者有更好的解决方案来满足我的需求