webpackEs6Config.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const path = require( 'path' );
  7. const webpack = require( 'webpack' );
  8. const BabiliPlugin = require( 'babili-webpack-plugin' );
  9. module.exports = function getWebpackConfig( destinationPath, moduleName ) {
  10. return {
  11. devtool: 'cheap-source-map',
  12. entry: [
  13. path.resolve( __dirname, '..', 'ckeditor.js' )
  14. ],
  15. output: {
  16. path: path.resolve( __dirname, '..', destinationPath ),
  17. filename: 'ckeditor.es6.js',
  18. libraryTarget: 'umd',
  19. library: moduleName
  20. },
  21. plugins: [
  22. new BabiliPlugin()
  23. ],
  24. module: {
  25. rules: [
  26. {
  27. // test: **/ckeditor5-*/theme/icons/*.svg
  28. test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
  29. use: [ 'raw-loader' ]
  30. },
  31. {
  32. // test: **/ckeditor5-*/theme/**/*.scss
  33. test: /\.scss$/,
  34. use: [ 'style-loader', 'css-loader', 'sass-loader' ]
  35. }
  36. ]
  37. },
  38. resolveLoader: {
  39. modules: [
  40. 'node_modules'
  41. ]
  42. }
  43. };
  44. };