Loading external library fails "If loading a global module configure the global name via..."

Copper Contributor

I'm trying to load winston into the default React (hello world) component, but I cannot get it to work.

When running in workbench and adding the webpart I receive the following error:

 

Error: Unable to load web part script resources due to: Error: Error: https://spoppe-a.akamaihd.net/files/winston did not call System.register or AMD define. If loading a global module configure the global name via the meta exports property for script injection support. Error loading https://spoppe-a.akamaihd.net/files/winston. at http://dci5cg6011dzr:4321/node_modules/@microsoft/sp-client-preview/dist/sp-client-preview.js:17250:32

 

The winston.js file is loaded correctly, as I can see in the browser's network tab.

 

To reproduce, I performed the following:

- yo @microsoft/sharepoint (react option)

- npm install --save winston

- tsd install winston --save

- added the winston library as external reference in config/config.json

- in code: 

import * as Winston from "winston";

Winston.info("Demo logging from Hello World Component");

 

Windows 10, generator v0.1.2, chrome browser

0 Replies