8
0

webpack.config.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. })
  25. ],
  26. module: {
  27. rules: [
  28. {
  29. test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
  30. use: ['raw-loader']
  31. },
  32. {
  33. test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
  34. use: [
  35. {
  36. loader: 'style-loader',
  37. options: {
  38. injectType: 'singletonStyleTag',
  39. attributes: {
  40. 'data-cke': true
  41. }
  42. }
  43. },
  44. 'css-loader',
  45. {
  46. loader: 'postcss-loader',
  47. options: {
  48. postcssOptions: styles.getPostCssConfig({
  49. themeImporter: {
  50. themePath: require.resolve('@ckeditor/ckeditor5-theme-lark')
  51. },
  52. minify: true
  53. })
  54. }
  55. }
  56. ]
  57. }
  58. ]
  59. }
  60. };