-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Mix of ECMAScript modules & CommonJS causes vite & vitest issues #14097
Comments
Thanks for the issue, I tried to find workarounds but failed. The Two actions on our side:
|
I am not sure if this is related but it seems File:
This Issue is blocking us from using vite and vitest. Any Quick Fix would be appreciated. |
@HaNdTriX we will investigate this but I cannot promise or offer any quick fix at the moment.
Not related, this package has a different versioning. |
In relation to this issue, we released two alpha versions that properly mark packages as ESM modules. But this doesn't fix the Vitest issues. Other issues appear in relation to testing the editor in the node environment. We stumbled on similar problems in Jest and the same problems may appear for Vitest:
For now, we recommend switching the environment for Vitest to test the editor in the browser: import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
browser: {
enabled: true,
name: 'chrome',
provider: 'webdriverio'
// or "name: 'chromium'" and "provider: 'playwright'"
}
},
}); The tests will work without the need to update to alpha ESM packages. |
Changes to make our packages valid ESM are merged and will be released in January. You can follow the updates in #13673 |
A fix will be available in the next release. You'll be able to remove the workaround from the |
TLTR
Using
@ckeditor/ckeditor5-real-time-collaboration
breaks the build system of vitest (or vite) because ECMAScript modules and CommonJS Modules are used in the same NPM Package.📝 Provide detailed reproduction steps (if any)
✔️ Expected result
The test should pass
❌ Actual result
The log above suggests to inline @ckeditor deps to temporarily fix the issue (#13673), nevertheless this would not work, because the
@ckeditor/ckeditor5-real-time-collaboration
module is mixing ESM & CommonJS in the same npm package.❓ Possible solution
"type": "module",
to theirpackage.json
files@ckeditor/ckeditor5-real-time-collaboration
should be in (ECMAScript modules or CommonJS) and convert the files to the corresponding format.📃 Other details
37.1.0
"@ckeditor/ckeditor5-real-time-collaboration": "37.1.0"
Related Issue
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: