webpack.config.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // webpack.config.js
  2. 'use strict';
  3. /* eslint-env node */
  4. const path = require('path');
  5. module.exports = async () => {
  6. const { CKEditorTranslationsPlugin } = await import('@ckeditor/ckeditor5-dev-translations');
  7. const { styles } = await import('@ckeditor/ckeditor5-dev-utils');
  8. return {
  9. devtool: 'source-map',
  10. performance: { hints: false },
  11. entry: path.resolve(__dirname, 'src', 'ckeditor.js'),
  12. output: {
  13. library: 'CustomEditors',
  14. path: path.resolve(__dirname, 'build'),
  15. filename: 'ckeditor.js',
  16. libraryTarget: 'umd',
  17. libraryExport: 'default'
  18. },
  19. plugins: [
  20. // More plugins.
  21. // ...
  22. new CKEditorTranslationsPlugin({
  23. // See https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
  24. language: 'ru',
  25. additionalLanguages: 'all',
  26. })
  27. ],
  28. module: {
  29. rules: [
  30. {
  31. test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
  32. use: ['raw-loader']
  33. },
  34. {
  35. test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
  36. use: [
  37. {
  38. loader: 'style-loader',
  39. options: {
  40. injectType: 'singletonStyleTag',
  41. attributes: {
  42. 'data-cke': true
  43. }
  44. }
  45. },
  46. 'css-loader',
  47. {
  48. loader: 'postcss-loader',
  49. options: {
  50. postcssOptions: styles.getPostCssConfig({
  51. themeImporter: {
  52. themePath: require.resolve('@ckeditor/ckeditor5-theme-lark')
  53. },
  54. minify: true
  55. })
  56. }
  57. }
  58. ]
  59. }
  60. ]
  61. }
  62. };
  63. };