CKEditor 5 SVGs do not build properly
See original GitHub issue- Laravel Mix Version: 1.7.2
- Node Version: v8.9.4
- NPM Version: 5.6.0
- Yarn Version: 1.3.2
- OS: Fedora release 27
Description:
I am attempting to use the new CKEditor 5 Framework with Mix. As described in the CKEditor Quick Start Guide I have imported CKEditor libs into app.js (and removed everything else) then I built the file. The results seem to show the SVGs are not loaded properly and the icons in the editor toolbar are missing.
https://screenshots.firefox.com/LEYu0SnGQVMaew0E/127.0.0.1
I also receive this error output in the console.
XML Parsing Error: not well-formed
Location: http://127.0.0.1:8000/
Line Number 1, Column 1:
127.0.0.1:8000:1:1
I then attempted to fix the svg loader issue with the webpack config recommended on the guide.
mix.js('resources/assets/js/app.js', 'public/js').webpackConfig({
module: {
rules: [{
test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
use: ['raw-loader']
}]
}
});
It produces the same result. I also tried the full webpack config:
mix.js('resources/assets/js/app.js', 'public/js').webpackConfig({
module: {
rules: [{
test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
use: ['raw-loader']
}, {
test: /ckeditor5-[^/]+\/theme\/[^/]+\.scss$/,
use: [
'style-loader',
'css-loader',
'sass-loader'
]
}]
}
});
But I get errors:
ERROR Failed to compile with 1 errors 17:29:16
error in ./node_modules/@ckeditor/ckeditor5-editor-classic/theme/theme.scss
Module build failed:
// Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
^
Invalid CSS after "...load the styles": expected 1 selector or at-rule, was "var content = requi"
in /home/ryan/Sites/ckeditortesting/node_modules/@ckeditor/ckeditor5-editor-classic/theme/theme.scss (line 1, column 1)
@ ./node_modules/@ckeditor/ckeditor5-editor-classic/theme/theme.scss 4:14-198
@ ./node_modules/@ckeditor/ckeditor5-editor-classic/src/classiceditor.js
@ ./resources/assets/js/app.js
@ multi ./resources/assets/js/app.js
Here is the app.js
// app.js
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
ClassicEditor
.create( document.querySelector( '#editor' ), {
plugins: [ Essentials, Paragraph, Bold, Italic ],
toolbar: [ 'bold', 'italic' ]
} )
.then( editor => {
console.log( 'Editor was initialized', editor );
} )
.catch( error => {
console.error( error.stack );
} );
Without the custom webpack configurations mix says the SVGs are exported. I’m not sure where they are being exported.
DONE Compiled successfully in 2812ms 17:39:08
Asset Size Chunks Chunk Names
fonts/vendor/@ckeditor/ckeditor5-undo/theme/icons/undo.svg?2753736cbcf3b2effb8d48c0814062a9 233 bytes [emitted]
fonts/vendor/@ckeditor/ckeditor5-undo/theme/icons/redo.svg?8ea320f1905146e40376ea5ff82ef1c8 234 bytes [emitted]
fonts/vendor/@ckeditor/ckeditor5-basic-styles/theme/icons/bold.svg?436104cc4191810a16da276b12d62720 1.14 kB [emitted]
fonts/vendor/@ckeditor/ckeditor5-basic-styles/theme/icons/italic.svg?42697e1fe4701d27b907ce418d5266dc 663 bytes [emitted]
/js/app.js 1.97 MB 0 [emitted] [big] /js/app
Done in 4.47s.
Steps To Reproduce:
- Create a new Laravel Project
- Add CKEditor via yarn/npm
yarn && yarn add \@ckeditor/ckeditor5-editor-classic \
@ckeditor/ckeditor5-essentials \
@ckeditor/ckeditor5-paragraph \
@ckeditor/ckeditor5-basic-styles
- Add the previous app.js and build the js with yarn dev
- Set the welcome.blade.php file to the following:
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
</head>
<body>
<div id="editor">
<p>Editor content goes here.</p>
</div>
<script src="js/app.js"></script>
</body>
</html>
- Load the project homepage.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:14 (2 by maintainers)
Top Results From Across the Web
CKEditor 5 SVGs do not build properly · Issue #1397 - GitHub
I am attempting to use the new CKEditor 5 Framework with Mix. As described in the CKEditor Quick Start Guide I have imported...
Read more >Integrating from source - CKEditor 5 Documentation
Learn how to install, integrate and configure CKEditor 5 Builds and how to work with CKEditor 5 Framework, customize it, create your own...
Read more >CKEditor 5 v15.0.0 with horizontal line and SVG upload support
We are happy to announce the release of CKEditor 5 v15.0.0. This editor version introduces support for inserting horizontal lines, ...
Read more >Development environment - CKEditor 5 Documentation
Learn how to install, integrate and configure CKEditor 5 Builds and how to work with CKEditor 5 Framework, customize it, create your own...
Read more >Vue.js 2.x component - CKEditor 5 Documentation
# Configuring vue.config.js ... To build CKEditor with your application, certain changes must be made to the default project configuration. ... By default,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Here’s how i ended up overriding the default laravel-mix to correctly compile CKEditor5 without modifying it
--config=node_modules/laravel-mix/setup/webpack.config.jsinpackage.jsonscriptswebpack.config.js@hanreev thank you a lot! )