ngx-bootstrap: Angular Universal: SyntaxError: Unexpected token import
Update by @valorkin : blocked by Angular-CLI angular/angular-cli#7200
Hi Guys, Thank you for your great work!
I’m trying to make ngx-bootstrap work with Universal but getting this error when trying to run:
node_modules/ngx-bootstrap/modal/modal-backdrop.component.js:1
(function (exports, require, module, __filename, __dirname) { import { Component, ElementRef, Renderer } from '@angular/core';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.IBu+ (/private/var/folders/7w/snfpnc0x7yd302z6rsfs69zc0000gn/T/fbfn_10215rsiZqtRl494A/dist-server/main.a7ad34b20e2d30c271dd.bundle.js:1:146690)
Any suggestions?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 20
- Comments: 26 (6 by maintainers)
@abhijithmannath take a look on this thread
solving angular universal issues
This is why such questions should be on stack overwflow, so ppl can google it
We will publish fix next week, when qa out of vacation. You can verify fix here: https://ngx-universal.herokuapp.com/modals
I was explaining in similar issue, nodejs doest support es6 import style, so files should be compiled with webpack or typescript before using in node. Fully working sample can be found here https://github.com/valor-software/ngx-bootstrap/tree/development/scripts/universal
I just upgraded ngx-bootstrap to 2.0.0-beta.8 (confirmed it by checking node modules) But I still get a carousel error
node_modules/ngx-bootstrap/carousel/carousel.component.js:18
Can someone help me fix this ?
@neilhem thanks for link!