It has a way to use shared-workers with NuxtJS v.2.14.12? - vue.js

I've a NuxtJS application and I'm trying to share a websocket connection throught the open tabs. Researching for this, I have found a way using shared-workers but I dont found this at Nuxt / Nuxt PWA documentation. I only found way to create custom workers in Nuxt PWA module with workbox.

I've been solved this problem using a Worker-Loader in my project. With this, I can configure worker files, incluse type of worker (sharedworker in this case) and import like a javascript module inside my component file.
This helps me how to configure: Using webpack worker-loader with nuxt.js

Related

Use Electron in Vue project

I want put my Vue project in the Electron, so I find the method in the Internet. According to the given method on the Intenet, I make a demo to test it.
At frist, I create Vue project using vue create myProject, then I use vue add electron-builder to add Electron, then I choose the Electron version, then it prepare to install the additional dependencies. But the error is thereļ¼š
Someone could help me? Thanks!
electron-vue: An Electron & Vue.js quick start boilerplate with vue-cli scaffolding.
maybe you can try it.

How to adapt Vue component for browser build?

I have a legacy web application which I have introduced Vue into in a few places, via CDN. I have upgraded it from Vue 2 to Vue 3. There is a component used there which breaks with Vue 3, but there is a Vue 3 version of it. However, the author states this: "The component is packaged mainly for use with bundlers, if you require a browser build - post an issue." I do require a browser build. Is there some easy way I can do this for myself? I wasn't planning to use a bundler for this application, so I'm hoping I can use the existing modules to create a .js file I can use from the browser?

Integrate a stenciljs web component into a stenciljs app

I did build some web components with stencil and published them on npm. Now I want to integrate them into another stencil app but I can't find any suggestions how to do so or the suggestions I found so far are not working.
e.g. there is no collections attribute anymore on the stencil config to include external components and this, which I found on the official documentation to distribute the components is not working:
In a stencil-app-starter app
Run npm install my-name --save
Add an import to the npm packages: import my-component;
Then you can use the element anywhere in your template, JSX, html etc.
I know that the components work because I successfully integrated them into an Angular and React App already.
Thanks for your help in advance :)
I had the same problem and just solved it. I'm building a StencilJS app and tried to use my component library #elgervb/stencil-components.
Here is what I did to get it working:
I've added my library with:
yarn add #elgervb/stencil-components
and in tsconfig.json I added typeRoots to the compilerOptions to load my types:
"typeRoots": [
"node_modules/#elgervb"
]
After that I can use all of my components in my app:
<evb-filepicker accept="image/*">
<evb-button>Pick image</evb-button>
</evb-filepicker>
Hope this helps :-)

How to pre-render initial page in VueJS using Webpack?

Is it possible to pre-render initial page of a VueJS app in Webpack as its done in preact-cli?
https://github.com/developit/preact-cli
Possible option that I can think of is Vue SSR, but is there a plugin available which does this? I couldn't find any which works.
Nuxtjs supports static pre-rendering.

Adding Routing to a Vue.js cli 3.0 app

The new Vue.js 3.0 plugin architecture is nice, but it seems to to be missing a router plugin. If I choose not to install routing when I first create the project (vue create my-project), I'd expect that I could change my mind later and add routing with something like vue add #vue/router, but that plugin doesn't appear to exist. Is there a way to add routing from the CLI after the fact?
After some experimenting with vue-cli3, i found that you can use vue add to setup components you missed.
Use vue add router That set up the routing and created some sample components Home and About.
This also work for other modules like adding vuetify with vue add vuetify. You can read more about vue add from the plugins and presets guide
Have a look at the issue page here: https://github.com/vuejs/vue-cli/issues/1202, the conclusion is you can't use cli to add router if you didn't choose router initially.
With three reasons:
Late-adding router when you've already modified the entry file is extremely fragile.
If you haven't modified the file much, you can just re-generate the project instead.
If we only add the dependency and skip the file-modifying part, then it's easier to just npm install vue-router or yarn add vue-router.