TransWikia.com

Getting Module not found: Error: Can't resolve '@uidu/ckeditor5-tokenizr' when importing npm package that I installed

Stack Overflow Asked by JDiGz on November 14, 2020

So I installed @uidu/ckeditor5-tokenizr to my project. I see it in node_modules/@uidu/ckeditor5-tokenizr but when I have
import tokenizr from '@uidu/ckeditor5-tokenizr';

in my Vue Components section I get the following error

Module not found: Error: Can't resolve '@uidu/ckeditor5-tokenizr' in <path to file here>

I’m not doing anything crazy here.

Here is the file

<template>
  <ckeditor :editor="editor" v-model="editorData" :config="editorConfig"></ckeditor>
</template>


<script>
import CKEditor from '@ckeditor/ckeditor5-vue';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import tokenizr from '@uidu/ckeditor5-tokenizr';

export default {
  name: "Editor",
  components: {
    ckeditor: CKEditor.component
  },
  data() {
    return {
      editor: ClassicEditor,
      editorData: '<p>Editor Text Here</p>',
      editorConfig: {
      }
    };
  },
};
</script>

One Answer

My solution was changing the import to

import Tokenizr from '@uidu/ckeditor5-tokenizr/src/tokenizr';

The full path name. I still don't know why this was an issue because in the package.json within @uidu/ckeditor5-tokenizr there was this defined

"main": "src/tokenizr.js",

which I'm pretty sure should have found what I manually entered. Either way this fixed my issue for now.

Answered by JDiGz on November 14, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP