-
-
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
A bit confusing syntax required for RequireJS #545
Comments
The least confusing way to import would be this: const ClassicEditor = require( 'ckeditor' ).ClassicEditor; I thought that it's not possible, but it turns out that it is, to turn just one export of a module into a library. Right now, we're wrapping the entire module, so // In CommonJS environment.
const ClassicEditor = require( '@ckeditor/ckeditor5-build-classic/build/ckeditor.js' );
ClassicEditor.create; // [Function]
// If AMD is present, you can do this.
require( '/(ckeditor path)/build/ckeditor.js', ClassicEditor => {
ClassicEditor.create; // [Function]
} );
// As a global.
ClassicEditor.create; // [Function]
// As an ES6 module (if using webpack or Rollup).
import ClassicEditor from '@ckeditor/ckeditor5-build-classic/build/ckeditor';
ClassicEditor.create; // [Function] |
Nope, one correction: // In CommonJS environment.
const ClassicEditor = require( '@ckeditor/ckeditor5-build-classic/build/ckeditor.js' ).default;
ClassicEditor.create; // [Function] |
And you'd need to validate Requirejs, @wwalc. |
If the AMD case will be fine, then I'd only check how we can get rid of that |
@Reinmar
However, when I rebuilt editor by myself from the
The funniest thing happened when I run
|
|
Other: The build now defines the editor as its default export. This makes requiring the build easier when using AMD, CJS or ES6 modules. See ckeditor/ckeditor5#545. BREAKING CHANGE: The build now defines a default export instead of named export. See ckeditor/ckeditor5#545.
Other: The build now defines the editor as its default export. This makes requiring the build easier when using AMD, CJS or ES6 modules. See ckeditor/ckeditor5#545. BREAKING CHANGE: The build now defines a default export instead of named export. See ckeditor/ckeditor5#545.
Other: The build now defines the editor as its default export. This makes requiring the build easier when using AMD, CJS or ES6 modules. See ckeditor/ckeditor5#545. BREAKING CHANGE: The build now defines a default export instead of named export. See ckeditor/ckeditor5#545.
Feature: Allowed defining initial items of `ViewCollection` and `BodyCollection` in the constructor. See #6319. The `View#createCollection()` method also started accepting an iterator of views. MAJOR BREAKING CHANGE: `ViewCollection` no longer has the `locale` property. MAJOR BREAKING CHANGE: The `ViewCollection#constructor()` no longer accepts the `locale` as a parameter.
Other: The build now defines the editor as its default export. This makes requiring the build easier when using AMD, CJS or ES6 modules. See ckeditor/ckeditor5#545. BREAKING CHANGE: The build now defines a default export instead of named export. See ckeditor/ckeditor5#545.
While playing with RequireJS and CKEditor 5 to validate the API docs I found that using CKEditor is quite counterintuitive:
https://github.com/wwalc/ckeditor5-test-requirejs/blob/master/scripts/app/main.js#L4
In short, the following code works:
I was expecting something like
The text was updated successfully, but these errors were encountered: