how to make changes to angular.json that used to go in webpack.config.js

27 views
Skip to first unread message

Reza Razavipour

unread,
Jun 19, 2018, 8:28:29 PM6/19/18
to Angular and AngularJS discussion

I am trying to fix the following error:


Module not found: Error: Cannot resolve module 'net' in ....../node_modules/stompjs/lib 



I read in https://stackoverflow.com/questions/36228979/how-do-we-import-stompjs-in-a-browser-or-something-like-stompjs


about making changes to webpack.config.js, namely

node: { net: 'empty', tls: 'empty', dns: 'empty' }


except I am using Angular CLI 6 and I only have angular.json file. What is the correct way to make this change?

Sander Elias

unread,
Jun 22, 2018, 3:14:16 PM6/22/18
to Angular and AngularJS discussion
Hi Reza,

Do something like this in your polyfills.js:

(window as any).global = window;
(window as any).net = {}

Put in the "globals" you are missing.

Regards
Sander
Reply all
Reply to author
Forward
0 new messages