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

Importing @ckeditor/ckeditor5-build-classic breaks @babel/preset-env #44

Closed
Livijn opened this issue Apr 13, 2019 · 5 comments
Closed
Labels
resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior).

Comments

@Livijn
Copy link

Livijn commented Apr 13, 2019

As the title suggests, whenever I import the @ckeditor/ckeditor5-build-classic it breaks my application after running babel with @babel/preset-env.

The generated file starts with this line var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));. It seems like it is double parsing it or something, I'm not sure. But when I comment out that part the app.es5.js is working.

I am using Laravel Mix with webpack and babel like this:

mix.js('resources/js/app.js', 'public/js')
    .extract()
    .babel(['public/js/app.js', 'public/js/vendor.js'], 'public/js/app.es5.js')
    .sass('resources/sass/app.scss', 'public/css')
    .sass('resources/sass/pdf.scss', 'public/css')
    .version();

I am importing the build like this: import ClassicEditor from "@ckeditor/ckeditor5-build-classic"

@Livijn
Copy link
Author

Livijn commented Apr 13, 2019

For now I created a mixin that loads the script dynamically from the CDN.

export default {
    methods: {
        loadScript(src, callback = null) {
            let script = document.createElement('script');
            script.setAttribute('src', src);
            script.addEventListener('load', callback);
            document.head.appendChild(script)
        },
    }
}

Then I use it like this, along with a v-if="editor" on the <ckeditor>

created() {
    this.loadScript('https://cdn.ckeditor.com/ckeditor5/12.0.0/classic/ckeditor.js', _ => {
        this.editor = window.ClassicEditor;
    })
},

@Mgsy
Copy link
Member

Mgsy commented Apr 15, 2019

Hello, please take a look at our guide about integrating CKEditor 5 with Vue.js. Does it solve your problem?

@Mgsy Mgsy added the pending:feedback This issue is blocked by necessary feedback. label Apr 15, 2019
@Livijn
Copy link
Author

Livijn commented Apr 15, 2019

No, since I need support for IE 11. I was using https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/vuejs.html#using-es6-modules before.

@ma2ciek
Copy link
Contributor

ma2ciek commented Apr 15, 2019

Bear in mind that CKEditor 5 doesn't run on IE11. If you're interested in this topic please vote there or leave a note, we're experimenting with it a little now.

@Livijn
Copy link
Author

Livijn commented Apr 15, 2019

Ok, then we can close this.

@Livijn Livijn closed this as completed Apr 15, 2019
@ma2ciek ma2ciek added resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior). and removed pending:feedback This issue is blocked by necessary feedback. labels Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior).
Projects
None yet
Development

No branches or pull requests

3 participants