Fixes for NPM packages in preview1 (#1540)

This commit is contained in:
Andrew Stanton-Nurse 2018-03-06 15:14:42 -08:00 committed by GitHub
parent 5fcfd67e84
commit 68f58a8dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 25 deletions

View File

@ -22,31 +22,13 @@ export default function(rootDir, moduleGlobals) {
banner: "/* @license\r\n" +
" * Copyright (c) .NET Foundation. All rights reserved.\r\n" +
" * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n" +
"*/",
" */",
globals: moduleGlobals,
},
external: function (m) {
let match = m.match(/node_modules/);
if (match) {
let moduleName = m.substring(match.index + "node_modules".length + 1);
let slashIndex = moduleName.indexOf('/');
if(slashIndex < 0) {
slashIndex = moduleName.indexOf('\\');
}
moduleName = moduleName.substring(0, slashIndex);
if(polyfills.indexOf(moduleName) >= 0) {
// This is a polyfill
console.log(`Importing polyfill: ${m}`);
return false;
}
else if(!allowed_externals.indexOf(moduleName)) {
console.log(`WARNING: External module '${m}' in use.`);
}
return true;
}
return false;
},
// Mark everything in the dependencies list as external
external: Object.keys(pkg.dependencies || {}),
plugins: [
commonjs(),
resolve({

View File

@ -3,7 +3,7 @@ JavaScript and TypeScript clients for SignalR for ASP.NET Core
## Installation
```bash
npm install @aspnet/signalr-client
npm install @aspnet/signalr
```
## Usage
@ -36,7 +36,7 @@ connection.start()
### Example (NodeJS)
```JavaScript
const signalR = require("@aspnet/signalR");
const signalR = require("@aspnet/signalr");
let connection = new signalR.HubConnection('/chat');
@ -46,4 +46,4 @@ connection.on('send', data => {
connection.start()
.then(() => connection.invoke('send', 'Hello'));
```
```