Is it possible to supply options to the Quasar App Extension? #14926
Replies: 3 comments 5 replies
-
I semi solved the problem, by installing my extension as import { boot } from 'quasar/wrappers'
import VuePlugin, { smartImport } from 'quasar-ui-x'
export default boot(({ app }) => {
app.use(VuePlugin, {
__importer__: function(){
return smartImport(component => {
return () => import(`src/${component}.vue`)
})
})
})
}) In package.json I had to add 2 packages "vite-plugin-dynamic-import": "^1.2.3",
"vite-plugin-dynamic-import-module": "^0.2.1", Also in quasar.config.js I had to add: const dynamicImport = require('vite-plugin-dynamic-import').default
...
vitePlugins: [
....,
dynamicImport()
] It worked! By supplying the dynamic import function from this Quasar application scope it made it resolve correctly both on dev and build. Is there a way to do through the That double layering of 2 packages to create an extension ( But still the benefits of install, and prompt scripts exists in that layering. Can someone explain why there are 2 layers instead of 1 for App Extensions, it makes it cumbersome to develop Quasar extensions cause you have to track 2 packages simultaneously. Can this process be simplified? I think it would make Quasar top of the line product and inspire more people to make extensions for this amazing framework. |
Beta Was this translation helpful? Give feedback.
-
Out of curiosity, can you explain the purpose of the app extension you are trying to create? We've never had anyone mention needing both the UI and normal app ext kits in one extension, so this seems pretty niche and also a reason to understand your goals. Scott |
Beta Was this translation helpful? Give feedback.
-
QDialog is the modal dialog for Quasar, there is a plugin and a component. I am using 'quasar-ui-x' separately now and it works, but I started off with the UI Kit extension that comes with quasar, and that is how it was setup there, 2 layers one containing another. My App Extension, makes it seemless to pass down a component inside the dialog and pass props into the component as well, reactively both via template tags and via code, using the same code. |
Beta Was this translation helpful? Give feedback.
-
I am developing an App Extension which requires some options passed down to it from the main application, to make the resolution of dynamic imports available properly from within the quasar extension that I am making.
The dynamic import must resolve to the directories relative to the main project, not relative to the node_modules/extension-folder/src, for that the dynamic import function has to be specified I presume manually by the user of App Extension like:
Hypothetical line below:
Vue.use(Extension, { options: function dynamicImportFunction() { return () => import(`src/${component}.vue`) } })
How can I implement such a process in Quasar, as the App Extension is loaded in the background by Quasar itself, I do not see an exposed API where I can modify this.
Without proper resolutions of dynamic imports used by my package, my package becomes half useless and impossible to make.
How would you go about solving such a problem?
I am relatively new to Vue and Quasar, so am I missing something obvious here?
Beta Was this translation helpful? Give feedback.
All reactions