webpack.config.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. /* eslint-env node */
  7. const path = require( 'path' );
  8. const webpack = require( 'webpack' );
  9. const { bundler } = require( '@ckeditor/ckeditor5-dev-utils' );
  10. const { getPostCssConfig } = require( '@ckeditor/ckeditor5-dev-utils' ).styles;
  11. const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' );
  12. const BabiliPlugin = require( 'babel-minify-webpack-plugin' );
  13. const buildConfig = require( './build-config' );
  14. module.exports = {
  15. devtool: 'source-map',
  16. entry: path.resolve( __dirname, 'src', 'ckeditor.js' ),
  17. output: {
  18. path: path.resolve( __dirname, 'build' ),
  19. filename: 'ckeditor.js',
  20. libraryTarget: 'umd',
  21. libraryExport: 'default',
  22. library: buildConfig.moduleName
  23. },
  24. plugins: [
  25. new CKEditorWebpackPlugin( {
  26. languages: [ buildConfig.language ]
  27. } ),
  28. new BabiliPlugin( null, {
  29. comments: false
  30. } ),
  31. new webpack.BannerPlugin( {
  32. banner: bundler.getLicenseBanner(),
  33. raw: true
  34. } )
  35. ],
  36. module: {
  37. rules: [
  38. {
  39. test: /\.svg$/,
  40. use: [ 'raw-loader' ]
  41. },
  42. {
  43. test: /\.css$/,
  44. use: [
  45. {
  46. loader: 'style-loader',
  47. options: {
  48. singleton: true
  49. }
  50. },
  51. {
  52. loader: 'postcss-loader',
  53. options: getPostCssConfig( {
  54. themePath: require.resolve( '@ckeditor/ckeditor5-theme-lark' ),
  55. minify: true
  56. } )
  57. },
  58. ]
  59. }
  60. ]
  61. }
  62. };