错误 Angular 5 + NGX_Restangular + Webpack-dev-server

Error Angular 5 + NGX_Restangular + Webpack-dev-server

使用Angular 5 + NGX_Restangular + Webpack-dev-server

Angular 5
"ngx-restangular": "2.2.3"
"webpack": "4.5.0",
"webpack-dev-server": "3.1.3"

成功构建应用程序并启动 Web 服务器 = ng serve

运行 在 运行 ng eject

之后使用 webpack 在 Web 服务器上应用程序失败
npm start 

npm start = '"start": "webpack-dev-server --port=4200"'

Chrome 控制台:

    core.js:1448 ERROR Error: Uncaught (in promise): TypeError: _.isArray is not a function
TypeError: _.isArray is not a function
    at RestangularFactory (ngx-restangular.config.js:11)
    at _callFactory (core.js:10916)
    at _createProviderInstance (core.js:10868)
    at resolveNgModuleDep (core.js:10850)
    at _createClass (core.js:10895)
    at _createProviderInstance (core.js:10865)
    at resolveNgModuleDep (core.js:10850)
    at NgModuleRef_.webpackJsonp../node_modules/@angular/core/esm5/core.js.NgModuleRef_.get (core.js:12087)
    at resolveNgModuleDep (core.js:10854)
    at NgModuleRef_.webpackJsonp../node_modules/@angular/core/esm5/core.js.NgModuleRef_.get (core.js:12087)
    at RestangularFactory (ngx-restangular.config.js:11)
    at _callFactory (core.js:10916)
    at _createProviderInstance (core.js:10868)
    at resolveNgModuleDep (core.js:10850)
    at _createClass (core.js:10895)
    at _createProviderInstance (core.js:10865)
    at resolveNgModuleDep (core.js:10850)
    at NgModuleRef_.webpackJsonp../node_modules/@angular/core/esm5/core.js.NgModuleRef_.get (core.js:12087)
    at resolveNgModuleDep (core.js:10854)
    at NgModuleRef_.webpackJsonp../node_modules/@angular/core/esm5/core.js.NgModuleRef_.get (core.js:12087)
    at resolvePromise (zone.js:814)
    at resolvePromise (zone.js:771)
    at zone.js:873
    at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:4740)
    at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)

只有当我注入 restangular 并使用 webpack-dev-server 时才会发生这种情况。

import { Component, OnInit} from '@angular/core';
import { Restangular } from 'ngx-restangular';

@Component({
  selector: 'app-onenote-open',
  templateUrl: './onenote-open.component.html',
  styleUrls: ['./onenote-open.component.scss']
})
export class OnenoteOpenComponent implements OnInit {

  constructor(@Inject(Restangular) public xxx) { }

  ngOnInit() {
  }

}

ngx-restangular 2.2.3 和 ng ejects > webpack.config.js

似乎有问题

使用 package.json > "ngx-restangular": "2.3.0-beta.3"

解决了问题