Aurelia - aurelia.json - @aspnet/signalr.js


#1

I am trying to get signalr to work with Aurelia.

I am using typescript.

My import looks like this

import * as signalR from ‘@aspnet/signalr’;

I have added this to my aurelia.json

      {
        "name": "@aspnet/signalr.js",
        "path": "../node_modules/@aspnet/signalr/dist",
        "main": "browser/signalr.min"
      },

Refused to execute script from ‘http://localhost:7070/src/@aspnet/signalr.js’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.

Is the “/” messing up the import?

Bryan


#2

If you want it working now, try auto tracing cli, it should work for scoped npm package. It’s going to be released in few weeks time. BTW, with auto-tracing, you can remove the config for signalr (and many others) from aurelia.json.

Please read the second post in the PR for testing it.
First update package.json with "aurelia-cli": "huochunpeng/cli#at47", reinstall packages.
Your app should work without any modification. Then you can start trimming off dependencies from aurelia.json to take advantage of auto-tracing.

Let me know if you encounter any bug.

Furthermore, turn on cache to see performance boost, update aurelia.json with

"options": {
  "minify": ...
  "cache": "dev & stage"
}

Use "cache":true if you want cache for every env


#3

BTW, for existing cli, you should not include .js in package name, try

{
        "name": "@aspnet/signalr",
        ...
}

#4

The “.js” was it.

I know better too.

Thanks for the help!

Bryan

PS I will check out the auto tracing cli