JonnyBGod / ngx-scrollspy

Angular ScrollSpy Service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work with angular universal

aharris opened this issue · comments

Works fine running client side but not with Universal.

/node_modules/ngx-scrollspy/dist/index.js:1 (function (exports, require, module, __filename, __dirname) { import { NgModule, Inject, Optional, OpaqueToken, SkipSelf } from '@angular/core'; ^^^^^^ SyntaxError: Unexpected token import at Object.exports.runInThisContext (vm.js:76:16) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.<anonymous> (/Users/aharris/Projects/PNC/portal/src/app/app.module.ts:15:1) at Module._compile (module.js:570:32)

Any help with this much appreciated.

I have published a fork which works with Universal.

https://www.npmjs.com/package/@oasisdigital/ngx-scrollspy

However, I am not confident that it contains the right way to implement universal compatibility. Therefore, no PR yet.

If a Angular Universal guru comes along and would like to inspect what I did and suggest whether it is the right solution, here is the relevant commit:

OasisDigital@a9d6c93