improve double-import error message

This commit is contained in:
Kevin Jahns 2022-06-13 10:27:04 +02:00
parent 4504196d5c
commit 29fb4a0aab

View File

@ -101,9 +101,9 @@ const importIdentifier = '__ $YJS$ __'
if (glo[importIdentifier] === true) {
/**
* Dear reader of this warning message. Please take this seriously.
* Dear reader of this message. Please take this seriously.
*
* If you see this message, please make sure that you only import one version of Yjs. In many cases,
* If you see this message, make sure that you only import one version of Yjs. In many cases,
* your package manager installs two versions of Yjs that are used by different packages within your project.
* Another reason for this message is that some parts of your project use the commonjs version of Yjs
* and others use the EcmaScript version of Yjs.
@ -112,6 +112,6 @@ if (glo[importIdentifier] === true) {
* e.g. `struct instanceof GC`. If you imported different versions of Yjs, it is impossible for us to
* do the constructor checks anymore - which might break the CRDT algorithm.
*/
console.warn('Yjs was already imported. Importing different versions of Yjs often leads to issues.')
console.error('Yjs was already imported. This breaks constructor checks and will lead to isssues!')
}
glo[importIdentifier] = true