mean-expert-official / loopback-sdk-builder

Tool for auto-generating Software Development Kits (SDKs) for LoopBack
Other
399 stars 178 forks source link

imports: [ ... SDKBrowserModule.forRoot() ] #612

Closed Jeffrs123 closed 6 years ago

Jeffrs123 commented 6 years ago

What type of issue are you creating?

What version of this module are you using?

Please add a description for your issue:

For reproduce the error: When I start a new Angular project, using the version of 6.1.0. Generate a SDK, with version "@mean-expert/loopback-sdk-builder": "^2.3.1", And when I am make the import the imports property

SDKBrowserModule.forRoot(). Turns in the error, on consolog:

ReferenceError: global is not defined[Learn More] binary.js:10

just to notice, i'm using the full path according with the instructions: import { SDKBrowserModule } from './shared/sdk/index';

It may be, something with my the SDK? I've already tryed the with the version 2.1.0, but acuses errors for not enconter the module "rxjs-compat" and its dependencies.

Because, if it'snt with this version, the problem, may stay in this version of Angular or Loopback.

SDK: ng2web

Bellow, the package.json of loopback:

{ "name": "lopTest", "version": "1.0.0", "main": "server/server.js", "engines": { "node": ">=4" }, "scripts": { "lint": "eslint .", "start": "node .", "posttest": "npm run lint && nsp check" }, "dependencies": { "@mean-expert/loopback-sdk-builder": "^2.1.0", "compression": "^1.0.3", "cors": "^2.5.2", "helmet": "^3.10.0", "loopback": "^3.19.0", "loopback-boot": "^2.6.5", "loopback-component-explorer": "^6.0.0", "loopback-ds-timestamp-mixin": "^3.4.1", "serve-favicon": "^2.0.1", "strong-error-handler": "^3.0.0" }, "devDependencies": { "eslint": "^3.17.1", "eslint-config-loopback": "^8.0.0", "nsp": "^3.2.1" }, "repository": { "type": "", "url": "" }, "license": "UNLICENSED", "description": "lopTest" }

And the Angular: { "name": "test-app", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^6.1.0", "@angular/common": "^6.1.0", "@angular/compiler": "^6.1.0", "@angular/core": "^6.1.0", "@angular/forms": "^6.1.0", "@angular/http": "^6.1.0", "@angular/platform-browser": "^6.1.0", "@angular/platform-browser-dynamic": "^6.1.0", "@angular/router": "^6.1.0", "core-js": "^2.5.4", "rxjs": "^6.0.0", "zone.js": "~0.8.26" }, "devDependencies": { "@angular-devkit/build-angular": "~0.7.0", "@angular/cli": "~6.1.2", "@angular/compiler-cli": "^6.1.0", "@angular/language-service": "^6.1.0", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "codelyzer": "~4.2.1", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~1.7.1", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.0", "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.3.0", "ts-node": "~5.0.1", "tslint": "~5.9.1", "typescript": "~2.7.2" } }

souvrard commented 6 years ago

Its seems that it is a problem between soket-io and angular... angular no longer declare global variable

you have to add a line in polyfill.ts (/app/src/polyfill.ts, line 70)

(window as any).global = window;

it works for me...

Jeffrs123 commented 6 years ago

Thank you so much @souvrard ! Now works like a pretty and happy baby!!!