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 value 'CKEditorModule' imported by the module 'AppModule'` #50

Closed
theunreal opened this issue Oct 23, 2016 · 6 comments
Closed

Comments

@theunreal
Copy link

Uncaught Error: Unexpected value 'CKEditorModule' imported by the module 'AppModule'

After installing & importing in my app module.

Any ideas?

@LeonardCModoran
Copy link

LeonardCModoran commented Oct 25, 2016

Having the same error, when using Webpack. With SystemJS everything is working fine.

Later: Had to fix this issue, and what I did is copy the module and the component from the src file inside my project, then done some small edits (had some highlighting issues like @input() config: any;) and then imported from the global scope CKEDITOR using: declare const CKEDITOR: any; Last step was to import the module from the new location and the error has gone...

my guess is how has been exported eg: export * from '...' and maybe should have been export {CKEditorComponent} from '..' as per eg: angular/angular-cli#1831 (comment)

@Nandan108
Copy link

Nandan108 commented Nov 4, 2016

Hi!
I tracked down the error to it's point of origin, in webpack:///./~/@angular/core/bundles/compiler.umd.js:14038.

The compiler verifies that each module is truly a module by checking that the object provided has a metadata object that is an instance of DecoratorFactory as defined in webpack:///./~/@angular/core/bundles/core.umd.js.

The problem happens when the CKEditorModule's metadata object is instead an instance of DecoratorFactory as defined in another file:
webpack:///./~/ng2-ckeditor/~/@angular/core/bundles/core.umd.js.

In short, the issue arises from CKEditorModule using its own, separate copy of angular core, when loaded via WebPack. This explains why LeonardCModoran's workaround worked: copying the Ng2CKEditor code into his project ensured that it used the same angular core as the rest of his code.

That's as far as I'll go unfortunately. I haven't studied how to develop and publish shareable components or libraries in Ng2, so I haven't got a clue how to fix this. Hopefully someone can take it from there?

Update:
In the end, deleting the node_modules sub-folder was the only thing needed to get it working.
rm -R node_modules/ng2-ckeditor/node_modules/
Now how the heck did I end up with a node_modules subdir in there? I just deleted the whole ng2-ckeditor folder and re-ran npm install. Now it's back, but clean of any unneeded stuff. And it works out of the box. Oh well...

@yabab-dev
Copy link
Owner

Can someone please share a reproduction repo on github ? I'll try to fix this soon, and repo can help some people in #54

Thanks !

@yabab-dev
Copy link
Owner

Hi,
Can anyone tests latest version (1.1.5) ?
Thanks

@Nandan108
Copy link

Hi,
The issue happened to me again some time ago for the same reason described above: node_modules/ng2-ckeditor/node_modules/ was present. After removing node_modules, it worked fine.

Just now I updated to 1.1.5 and it installed just fine, without the incriminated subdir.
I guess you can close this issue.

@yabab-dev
Copy link
Owner

thanks @Nandan108 !

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

No branches or pull requests

4 participants