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

%3CLINGO-SUB%20id%3D%22lingo-sub-14249%22%20slang%3D%22en-US%22%3ELoading%20external%20library%20fails%20%22If%20loading%20a%20global%20module%20configure%20the%20global%20name%20via...%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-14249%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20load%20winston%20into%20the%20default%20React%20(hello%20world)%20component%2C%20but%26nbsp%3BI%20cannot%20get%20it%20to%20work.%3C%2FP%3E%3CP%3EWhen%20running%20in%20workbench%20and%20adding%20the%20webpart%20I%20receive%20the%20following%20error%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EError%3A%20Unable%20to%20load%20web%20part%20script%20resources%20due%20to%3A%20Error%3A%20Error%3A%20https%3A%2F%2Fspoppe-a.akamaihd.net%2Ffiles%2Fwinston%20did%20not%20call%20System.register%20or%20AMD%20define.%20If%20loading%20a%20global%20module%20configure%20the%20global%20name%20via%20the%20meta%20exports%20property%20for%20script%20injection%20support.%20Error%20loading%20https%3A%2F%2Fspoppe-a.akamaihd.net%2Ffiles%2Fwinston.%20at%20http%3A%2F%2Fdci5cg6011dzr%3A4321%2Fnode_modules%2F%40microsoft%2Fsp-client-preview%2Fdist%2Fsp-client-preview.js%3A17250%3A32%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20winston.js%20file%20is%20loaded%20correctly%2C%20as%20I%20can%20see%20in%20the%20browser's%20network%20tab.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20reproduce%2C%20I%26nbsp%3Bperformed%20the%20following%3A%3C%2FP%3E%3CP%3E-%20yo%26nbsp%3B%3Ca%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F41501%22%3E%40microsoft%3C%2Fa%3E%2Fsharepoint%20(react%20option)%3C%2FP%3E%3CP%3E-%20npm%20install%20--save%20winston%3C%2FP%3E%3CP%3E-%20tsd%20install%20winston%20--save%3C%2FP%3E%3CP%3E-%20added%20the%20winston%20library%20as%20external%20reference%20in%20config%2Fconfig.json%3C%2FP%3E%3CP%3E-%20in%20code%3A%26nbsp%3B%3C%2FP%3E%3CPRE%3Eimport%20*%20as%20Winston%20from%20%22winston%22%3B%0A%0AWinston.info(%22Demo%20logging%20from%20Hello%20World%20Component%22)%3B%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWindows%2010%2C%20generator%20v0.1.2%2C%20chrome%20browser%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

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