我将我的项目从angular-5.x升级到angular-6.x并且它开始给出以下错误,甚至创建虚拟全局变量也不起作用,如此处给出Angular 6 Auth0 - 全局未定义
错误如下:
Uncaught ReferenceError: global is not defined
at Object../node_modules/has-binary2/index.js (index.js:10)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/socket.io-parser/index.js (index.js:8)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/socket.io-client/lib/index.js (index.js:7)
at __webpack_require__ (bootstrap:81)
at Object../src/app/app4pc/apiConnection/services/ApiConnectionServer.ts (auth.interceptor.ts:8)
at __webpack_require__ (bootstrap:81)
at Object../src/app/app4pc/apiConnection/toServer.module.ts (ApiConnectionServer.ts:11)
at __webpack_require__ (bootstrap:81)
Run Code Online (Sandbox Code Playgroud)
解决这个后,我得到以下错误:
Uncaught ReferenceError: process is not defined
at Object../node_modules/process-nextick-args/index.js (index.js:3)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/readable-stream/lib/_stream_readable.js (_stream_readable.js:26)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/readable-stream/readable-browser.js (readable-browser.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/simple-peer/index.js (index.js:7)
at __webpack_require__ (bootstrap:81)
at Object../src/app/util/services/call.services.ts (notification.service.ts:12)
at __webpack_require__ (bootstrap:81) …Run Code Online (Sandbox Code Playgroud) 我socket.io-client在React网络应用程序中添加了插件后出现以下错误.
未捕获的ReferenceError:在Object ../ node_modules/socket的webpack_require(bootstrap:22)处的Object ../ node_modules/socket.io-parser/is-buffer.js(is-buffer.js:4)中未定义 global. IO分析器/ binary.js(binary.js:8)在webpack_require(自举:22)在对象../ node_modules/socket.io解析器/ index.js(index.js:8)在webpack_require(自举:22 )at object ../ node_modules/socket.io-client/lib/index.js(index.js:7)at webpack_require(bootstrap:22)at Object ../ src/client/components/gettingStarted/socketest.js( socketest.js:1)at webpack_require(bootstrap:22)
以下是我的webpack配置文件.
/*eslint-disable*/
var Path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var FileChanger = require('webpack-file-changer');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var Webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var fs = require('fs');
var isProduction = process.env.NODE_ENV === 'production';
var cssOutputPath = isProduction ? 'styles/app.css' : 'styles/app.css';
var jsOutputPath = isProduction …Run Code Online (Sandbox Code Playgroud)