ReferenceError: global is not defined at…
- User
ReferenceError: global is not defined at node_modules/sockjs-client/lib/utils/browser-crypto.js (browser-crypto.js:3:1) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50) at node_modules/sockjs-client/lib/utils/random.js (random.js:3:14) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50) at node_modules/sockjs-client/lib/utils/event.js (event.js:3:14) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50) at node_modules/sockjs-client/lib/transport/websocket.js (websocket.js:3:13) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50) at node_modules/sockjs-client/lib/transport-list.js (transport-list.js:5:3) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50) - angular, websoket, como lo soluciono? que dice el error
- Assistant
- User
al principio no tenia este archivo, tube que crearlo 1. Abre tu archivo src/polyfills.ts y añade:
(window as any).global = window; - y no mefunciona, hay otra manera?
- Assistant
- User
Webpack - para que sirve eso? - responde en una linea
- Assistant
Webpack es una herramienta de bundling que convierte módulos con dependencias en archivos estáticos para entornos web.
- User
no quiero poner eso, me slae el error que debo poner eso? estaba haciendo una aplicaion que consume un servicio sprng boot, y lo que hice fue agregar websecked en spring boot, agregue las configuraciones en mi usaurio service para el crud yactualziacin en tiempo real y ya no funciona la aplicaion, antes si me funcionaba, pero por agregar logica para websocket ya no, que debo hacer, paso a paso
- Assistant
- User
eso ya lo hice, el problema es que me sale este error cuando inicio el cliente angular y no se ve nada - browser-crypto.js:3 Uncaught ReferenceError: global is not defined at node_modules/sockjs-client/lib/utils/browser-crypto.js (browser-crypto.js:3:1) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50) at node_modules/sockjs-client/lib/utils/random.js (random.js:3:14) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50) at node_modules/sockjs-client/lib/utils/event.js (event.js:3:14) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50) at node_modules/sockjs-client/lib/transport/websocket.js (websocket.js:3:13) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50) at node_modules/sockjs-client/lib/transport-list.js (transport-list.js:5:3) at __require (chunk-ASLTLD6L.js?v=632db6a7:37:50)
- Assistant
- User
import { environment } from ‘./environments/environment’;
if (environment.production) { enableProdMode(); } - no recooce eso - (window as any).global = window; esto no funciona - este es main.ts - import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';import { AppModule } from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule) .catch(err => console.error(err));
- cual seria el error y como lo soluciono
- Assistant