webpack.config.js 1.4 KB

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