Closed gvnn-gov closed 6 months ago
Hi Giovanni, thanks for raising this.
The short answer is that the docs for forms are incorrect and there's currently no way to import the form components into a plain Vue app.
It was our intention to try to make these components available to use outside of the SDP platform, however we've have had to focus our efforts the main SDP/nuxt offering.
Better documentation is a current priority for us and we hope to be able to provide better support for plain Vue form components in the future. We will fix the error in the forms README and keep you updated if the forms component become available.
Thanks a lot @jeffdowdle,
After digging into the code I found an alternative, but it's a bit of a hack. I have have added a resolve
path in our vite config like this:
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
"@dpc-sdp/ripple-ui-forms/vue": path.resolve(
__dirname,
"node_modules/@dpc-sdp/ripple-ui-forms/src/components",
),
},
},
});
And then created a omponents.ts
file that looks like this:
export { default as RplFormDropdown } from "@dpc-sdp/ripple-ui-forms/vue/RplFormDropdown/RplFormDropdown.vue";
export { default as RplFormLabel } from "@dpc-sdp/ripple-ui-forms/vue/RplFormLabel/RplFormLabel.vue";
Similar to https://github.com/dpc-sdp/ripple-framework/blob/develop/packages/ripple-ui-core/src/components.ts
This is a hack, but it allows me to use the components. The real solution would be replicating what's been done in
core
.
Glad you found a way forward @gvnn-gov! Will let you know when we properly export these and hopefully you can remove the alias in the future.
Environment
Darwin
v20.11.0
-
3.11.1
-
npm@10.2.4
-
-
-
-
Reproduction
I created a vue component
Describe the bug
Following the instructions at https://github.com/dpc-sdp/ripple-framework/tree/develop/packages/ripple-ui-forms#usage-vue I'm trying to import
RplFormDropdown
But I receive an error
And looking at https://github.com/dpc-sdp/ripple-framework/blob/d0ce9e2422a07d3a4ad37e639a2fb9e7c0c3543d/packages/ripple-ui-forms/package.json it is missing the
vue
export, that is present in the core library for example https://github.com/dpc-sdp/ripple-framework/blob/d0ce9e2422a07d3a4ad37e639a2fb9e7c0c3543d/packages/ripple-ui-core/package.json#L20Additional context
No response
Logs
Final checks