Angular 4具有通用的“意外令牌导入”

时间:2018-01-29 08:00:26

标签: node.js angular angular-universal

我的项目在没有通用的情况下正常运行,但我正在尝试使用Universal,而且我遇到了错误。

“NGX-页滚动/ SRC / NGX-页-scroll.service.js:1

('@ angular / core'中的函数(exports,require,module,__ filename,__ dirname){import {Injectable,Optional,SkipSelf,isDevMode}; “

我的package.json

 {
  "name": "resumable-ang",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
  "prestart": "ng build --prod && ngc",
  "start": "ts-node src/server.ts"
 },
  "private": true,
  "dependencies": {
  "@angular/animations": "^4.4.6",
  "@angular/common": "^4.0.0",
  "@angular/compiler": "^4.0.0",
  "@angular/core": "^4.0.0",
  "@angular/forms": "^4.0.0",
  "@angular/http": "^4.0.0",
  "@angular/platform-browser": "^4.0.0",
  "@angular/platform-browser-dynamic": "^4.0.0",
  "@angular/platform-server": "^4.*",
  "@angular/router": "^4.0.0",
  "@ng-select/ng-select": "^0.15.2",
  "@ngrx/effects": "^4.0.5",
  "@ngrx/store": "^4.0.3",
  "@types/jquery": "^3.2.15",
  "angular-hammer": "^2.2.0",
  "angular-progress-http": "^1.0.0",
  "core-js": "^2.4.1",
  "jquery": "^3.2.1",
  "ngx-carousel": "^1.3.5",
  "ngx-page-scroll": "^4.0.2",
  "ngx-progressbar": "^2.1.1",
  "rxjs": "^5.1.0",
  "web-animations-js": "^2.3.1",
  "zone.js": "^0.8.4"
},
  "devDependencies": {
  "@angular/cli": "1.1.1",
  "@angular/compiler-cli": "^4.0.0",
  "@angular/language-service": "^4.0.0",
  "@types/jasmine": "2.5.45",
  "@types/node": "~6.0.60",
  "codelyzer": "~3.0.1",
  "jasmine-core": "~2.6.2",
  "jasmine-spec-reporter": "~4.1.0",
  "karma": "~1.7.0",
  "karma-chrome-launcher": "~2.1.1",
  "karma-cli": "~1.0.1",
  "karma-jasmine": "~1.1.0",
  "karma-jasmine-html-reporter": "^0.2.2",
  "karma-coverage-istanbul-reporter": "^1.2.1",
  "protractor": "~5.1.2",
  "ts-node": "~3.0.4",
  "tslint": "~5.3.2",
  "typescript": "~2.3.3"
}

}

1 个答案:

答案 0 :(得分:0)

尝试在webpack配置中将该模块列入白名单

//webpack.server.js

target: 'node',
externals: [nodeExternals({
 whitelist: [
   /^Nolanus\/ngx-page-scroll/
 ]
 })],