-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Unexpected token import' error when used with angular universal rendering (platform - server) #91
Comments
Make sure you follow my comment here: #72 (comment) Also, try using |
Thanks Ibby. But this did not help. Do you have a ngx-facebook project using angular platform-server rendering that I can look at? This is a problem that the angular-cli team have acknowledged as well, I need some help looking for a work around till this is fixed. ngx-facebook may need a commonjs build as being done by angulartics2 here |
I don't have a current project that uses SSR. I tried it before, though. Did you try the I can publish a |
👍 that worked like a charm ! thanks ibby. ⭐️ |
Tried to import from
|
I am importing ngx-facebook using Now when I build, I also get the same warning as indicated above by matheusdavidson but build completes. And then when I fire my node command for running universal app, I get the below error var v = factory(!(function webpackMissingModule() { var e = new Error("Cannot find module ".""); e.code = 'MODULE_NOT_FOUND'; throw e; }()), exports); Error: Cannot find module "."
at webpackMissingModule (d:\Dist\server.js:9637:69)
at a.../../../../ngx-facebook/dist/umd/components/fb-comments/fb-comments.js.Object.defineProperty.value (d:\Dist\server.js:9637:147)
at Object.../../../../ngx-facebook/dist/umd/components/fb-comments/fb-comments.js (d:\Dist\server.js:9646:3)
at __webpack_require__ (d:\Dist\server.js:172:30)
at Object.../../../../ngx-facebook/dist/umd/components/fb-comments/fb-comments.ngfactory.js (d:\Dist\server.js:9741:10)
at __webpack_require__ (d:\Dist\server.js:172:30)
at Object.../../../../../src/app/components/content/content.component.ngfactory.js (d:\Dist\server.js:1252:11)
at __webpack_require__ (d:\Dist\server.js:172:30)
at Object.../../../../../src/app/app.server.module.ngfactory.js (d:\Dist\server.js:294:10)
at __webpack_require__ (d:\Dist\server.js:172:30) |
Hi, |
@kartikbb did you solve this? I have the same problem. |
Hey, I've encountered the same problem.. and in your AfterViewInit hook and in your index.html paste this script in your head tag: A bit dirty solution but doing the job for now. |
Am following this guide (https://coursetro.com/posts/code/68/Make-your-Angular-App-SEO-Friendly-(Angular-4-+-Universal) to add server rendering to my angular 2 app created with angular-cli.
It works fine until I add FacebookModule to my app's root module and use the FacebookService. Adding this leads to the above error at the step where I try and run my express server using ts-node.
The text was updated successfully, but these errors were encountered: