Skip to content
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 with Angular Universal #146

Open
SoftwareAndOutsourcing opened this issue Nov 26, 2018 · 5 comments
Open

Comments

@SoftwareAndOutsourcing
Copy link

Hi,

I'm getting an error with the ngx-facebook with Angular Universal. Steps to reproduce:

  1. git clone https://github.com/angular/universal-starter.git.
  2. npm i.
  3. Add ngx-facebook as described in the docs.
  4. npm run build:ssr && npm run serve:ssr.

Result: I get an SyntaxError: Unexpected token import error.

I created a demo repository in https://github.com/SoftwareAndOutsourcing/universal-starter-ngx-facebook-demo following the above steps.

Thanks.

@nch3ng
Copy link

nch3ng commented Feb 13, 2019

any solution for this error?

@HighSoftWare96
Copy link

Try importing the library directly from ngx-facebook/dist/umd

@aazo11
Copy link

aazo11 commented Jun 20, 2019

I was facing the same problem so I tried the suggested solution of importing from /dist/umd. Then when I import the library directly I get a number of warnings similar to the following when I do ng build --prod:

WARNING in ./node_modules/ngx-facebook/dist/umd/components/fb-quote/fb-quote.js 6:24-31
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Then when I deploy nothing works with error:

Uncaught Error: Cannot find module './components/fb-comment-embed/fb-comment-embed'

Any help would be greatly appreciated.

@tebantebanteban
Copy link

tebantebanteban commented Dec 28, 2019

@aazo11 do you found solution?

@azkarmoulana
Copy link

@aazo11 @tebantebanteban found any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants