lundi 23 juillet 2018

msal npm build run fails with loader problems

I'm trying to build msal so I can use it with nodejs. Specifically, I would like to verify e-mails are received by test users in end-to-end webdriverio tests.

I followed the npm msal guide here and got pretty far, but reached some errors during:

npm run build

.

npm run build

> msal@0.1.7 build C:\Users\User\TestAutomation\node_modules\msal
> npm run clean && npm run doc && npm run build:modules && webpack && grunt && npm test


> msal@0.1.7 clean C:\Users\User\TestAutomation\node_modules\msal
> shx rm -rf dist docs lib-commonjs lib-es6


> msal@0.1.7 doc C:\Users\User\TestAutomation\node_modules\msal
> typedoc --out ./docs ./src/**/* --gitRevision dev


Using TypeScript 2.2.2 from C:\Users\User\TestAutomation\node_modules\msal\node_modules\typedoc\node_modules\typescript\lib
Rendering [========================================] 100%

Documentation generated at C:\Users\User\TestAutomation\node_modules\msal\docs


> msal@0.1.7 build:modules C:\Users\User\TestAutomation\node_modules\msal
> tsc && tsc -m es6 --outDir lib-es6

Hash: 898d9837b77694c4a729
Version: webpack 3.12.0
Time: 244ms
          Asset     Size  Chunks             Chunk Names
        msal.js  8.59 kB    0, 1  [emitted]  msal
    msal.min.js  3.26 kB    1, 0  [emitted]  msal.min
    msal.js.map  3.67 kB    0, 1  [emitted]  msal
msal.min.js.map  14.4 kB    1, 0  [emitted]  msal.min
   [0] ./src/UserAgentApplication.ts 271 bytes {0} {1} [built] [failed] [1 error]
   [1] ./src/Logger.ts 290 bytes {0} {1} [built] [failed] [1 error]
   [2] multi ./src/index.ts 28 bytes {0} {1} [built]
   [3] ./src/index.ts 354 bytes {0} {1} [built]
   [4] ./src/User.ts 248 bytes {0} {1} [built] [failed] [1 error]
   [5] ./src/Constants.ts 357 bytes {0} {1} [built] [failed] [1 error]
   [6] ./src/RequestInfo.ts 247 bytes {0} {1} [built] [failed] [1 error]
   [7] ./src/Authority.ts 209 bytes {0} {1} [built] [failed] [1 error]

ERROR in ./src/Logger.ts
Module parse failed: Unexpected token (26:7)
You may need an appropriate loader to handle this file type.
| import { Utils } from "./Utils";
|
| export interface ILoggerCallback {
|   (level: LogLevel, message: string, containsPii: boolean): void;
| }
 @ ./src/index.ts 2:0-34 3:0-36
 @ multi ./src/index.ts

ERROR in ./src/Constants.ts
Module parse failed: Unexpected token (28:31)
You may need an appropriate loader to handle this file type.
|  */
| export class Constants {
|   static get errorDescription(): string { return "error_description"; }
|   static get error(): string { return "error"; }
|   static get scope(): string { return "scope"; }
 @ ./src/index.ts 5:0-40
 @ multi ./src/index.ts

ERROR in ./src/RequestInfo.ts
Module parse failed: Unexpected token (28:7)
You may need an appropriate loader to handle this file type.
|  */
| export class TokenResponse {
|   valid: boolean;
|   parameters: Object;
|   stateMatch: boolean;
 @ ./src/index.ts 6:0-45
 @ multi ./src/index.ts

ERROR in ./src/User.ts
Module parse failed: Unexpected token (30:17)
You may need an appropriate loader to handle this file type.
| export class User {
|
|     displayableId: string;
|     name: string;
|     identityProvider: string;
 @ ./src/index.ts 4:0-30
 @ multi ./src/index.ts

ERROR in ./src/Authority.ts
Module parse failed: Unexpected token (34:7)
You may need an appropriate loader to handle this file type.
|  * @hidden
|  */
| export enum AuthorityType {
|   Aad,
|   Adfs,
 @ ./src/index.ts 7:0-38
 @ multi ./src/index.ts

ERROR in ./src/UserAgentApplication.ts
Module parse failed: Unexpected token (39:8)
You may need an appropriate loader to handle this file type.
| import { AuthorityFactory } from "./AuthorityFactory";
|
| declare global {
|     interface Window {
|         msal: Object;
 @ ./src/index.ts 1:0-62 8:0-51
 @ multi ./src/index.ts
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! msal@0.1.7 build: `npm run clean && npm run doc && npm run build:modules && webpack && grunt && npm test`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the msal@0.1.7 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

I think this is a babel error:

You may need an appropriate loader to handle this file type

But I am not sure how to resolve it. I tried installing babel also, not sure if I need it somewhere.

I'm a bit new to these tools, so I'm sure this is a simple mistake. I spent a bit of time on it, so I wanted to reach out for help. If I resolve it, I'll update this question.

Much appreciated to the MS team for providing msal.

Aucun commentaire:

Enregistrer un commentaire