Overall approach for a Vue-based custom element library #7624
Unanswered
franck102
asked this question in
Help/Questions
Replies: 1 comment 3 replies
-
I really could use some help with this... any suggestions? I am using Vite to create a shared base module that should host Vue, but I don't really understand what Vue package I should be using (https://github.com/vuejs/core/tree/main/packages/vue#which-dist-file-to-use), nor how to configure Vite to use that package. The project is defined as a module:
so I assume that vue.runtime.esm-bundler.js is being used. My Vite config looks like this:
When I load the module in the browser however, I get this error:
coming from process.env.NODE_ENV being tested in a shared.esm-bundler.js script. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, I plan to use Vue 3 to create a library of custom elements that are to be used on third-party web sites. The final intent is to have up to 3-4 custom elements on a page, that will cooperate through events & element properties.
My idea was to have a "base" custom element that
The reason for using Vue is that the same components are also used in an SPA.
I have a few questions about the approach though:
does the approach make sense overall?
I am a bit fuzzy on how to design the "base" element and on how to make the Vue instance globally available - are there any sample projects I could use as a guide?
I am using the Vite configuration below, which mentions "global variables" for the UMD build - not sure how the base element should make those variables available; or how the esm version would get a hold of the Vue instance?
Beta Was this translation helpful? Give feedback.
All reactions