Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import @aspnet/signalr in Vue application

I am trying to import SignalR in my Vue.JS application. I use webpack to bundle modules.

In my package.json:

"dependencies": {
  "@aspnet/signalr": "^1.1.0"
}

In my component within script section:

<script>
  import  signalR  from '@aspnet/signalr';**
  ...
</script>

I can see signalR references in main.js (generated by webpack), but when I try to access it the mounted lifehook, I get the error in console:

"export 'default' (imported as 'signalR') was not found in '@aspnet/signalr'

How to import SignalR in a Vue component correctly?

like image 717
Elijah Dollin Avatar asked Dec 23 '22 02:12

Elijah Dollin


1 Answers

Try to import it this way:

const signalR = require('@aspnet/signalr');
like image 93
Vladislav Ladicky Avatar answered Jan 09 '23 02:01

Vladislav Ladicky