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

[Bug]: Unexpected token ':' #540

Open
jowin202 opened this issue May 7, 2024 · 4 comments
Open

[Bug]: Unexpected token ':' #540

jowin202 opened this issue May 7, 2024 · 4 comments

Comments

@jowin202
Copy link

jowin202 commented May 7, 2024

What happened?

Hi,
I'm following this tutorial (https://sibiraj-s.github.io/ngx-editor/introduction/) and I do exactly what it is said

ng new editortest2 (SCSS and SSR: yes)
cd editortest2
npm install ngx-editor

Then I put
import { NgxEditorModule } from 'ngx-editor';
into my component

and I add NgxEditorModule to my imports ... now the error is here.

Version

newest: "npm install ngx-editor" on ubuntu 24.04

Angular Version

newest under ubuntu 24.04

What browsers are you seeing the problem on?

Firefox

Link to reproduce

No response

Relevant log output

Unexpected token ':'

    at new AsyncFunction (<anonymous>)
    at instantiateModule (file:///home/johannes/angular/editortest2/node_modules/vite/dist/node/chunks/dep

20:12:36 [vite] Error when evaluating SSR module /main.server.mjs:
|- SyntaxError: Unexpected token ':'
    at new AsyncFunction (<anonymous>)
    at instantiateModule (file:///home/johannes/angular/editortest2/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:54894:28)

20:12:36 [vite] Internal server error: Unexpected token ':'
      at new AsyncFunction (<anonymous>)
      at instantiateModule (file:///home/johannes/angular/editortest2/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:54894:28)

Willing to submit a PR?

None (maybe later if I'm more advanced in angular/ts)

@sibiraj-s
Copy link
Owner

May be same as #520

@nacaru-w
Copy link

nacaru-w commented Jun 7, 2024

Getting the same error using Angular 17.3, did you find a solution? @jowin202

@DanielePetraliaDev
Copy link

I had the same problem and solved adding
await import('ngx-editor');
at the end of ngOnInit after checking I'm in browser.
I don't know why it works but for me it does.

@sibiraj-s
Copy link
Owner

Yeah the reason it could be working is when you do await import it might excluded in the SSR compilation process.

The reason this happens is because, the underlying library prosemirror doesn't support SSR, reason here #520 (comment)

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

4 participants