CS0103 The name 'ckeditor' does not exist in the current context

Volk Volk 551 Reputation points
2023-08-06T20:46:26.2633333+00:00

Hi!

I'm trying to hook "Word count and character count" in CKEditor: https://ckeditor.com/docs/ckeditor5/latest/features/word-count.html

  1. Installed node.js and NPM.
  2. Executed the command in the console: npm install --save @ckeditor/ckeditor5-word-count
    AAA
  3. The plugin has been installed in the project folder: ckeditor5-word-count
    BBB
  4. Now, I can't import it to the page where it should work.

CCC

Can you tell me how to import it to the page so that it starts working in code?
I tried to import in different ways, it does not work - various errors.
Maybe I'm doing something wrong?

Thanks!

Developer technologies | ASP.NET | ASP.NET Core
Microsoft 365 and Office | Development | Office JavaScript API
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 78,006 Reputation points Volunteer Moderator
    2023-08-06T22:49:43.89+00:00

    Neither razor pages or views support JavaScript import commands.

    You need to use the npm build tool of your choice to build a script file that is loaded via the script tag. The npm build should place the compiled script in the wwwroot folder.

    you could use a content copy command in the project file to copy from the node modules location to wwwroot and use the script tag.

    You could also use cdn for the script tag.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.