-
-
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
How to customize icons with webpack in the suggested way #1831
Comments
@ma2ciek, can you check it? |
As you can see at the source code of the As you might see most of the times your function is called after the resolution (as the requests don't match the regexp). The request after the resolution is enhanced by the loaders (that's why the paths are so long and contain weird characters) and actually, this option isn't used anymore. That's why you should change the E.g. try the following plugin:
|
To be clear, it's not a CKEditor 5 issue, that's how the Webpack plugin works. |
for ckeditor5 and webpack5, my implementation for custom ckeditor icons: const customCKEditorIcons = ['bold', 'italic'];
new webpack.NormalModuleReplacementPlugin(/ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/, result => {
const resource = result.createData.resource;
if (resource) {
const iconNamePaths = resource.split('/');
const iconName = iconNamePaths[iconNamePaths.length - 1].split('.')[0];
if (customCKEditorIcons.includes(iconName)) {
result.createData.resource = path.resolve(
__dirname,
`path/to/${iconName}.svg`,
);
}
}
}) |
@uptonking here you can find an easy solution for icons customization in webpack5: |
|
Is this a bug report or feature request? (choose one)
🐞 Bug report
💻 Dependencies
package.json
📋 Steps to reproduce
SOF article
✅ Expected result
❎ Actual result
📃 Other details that might be useful
Logging of resource.request's:
SOF article
The text was updated successfully, but these errors were encountered: