/** * @license Copyright (c) 2014-2023, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ 'use strict'; /* eslint-env node */ const path = require( 'path' ); const webpack = require( 'webpack' ); const { bundler, styles } = require( '@ckeditor/ckeditor5-dev-utils' ); const { CKEditorTranslationsPlugin } = require( '@ckeditor/ckeditor5-dev-translations' ); const TerserWebpackPlugin = require('terser-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); module.exports = { // devtool: 'source-map', performance: { hints: false }, entry: path.resolve(__dirname, 'src', 'ckeditor.js'), output: { // The name under which the editor will be exported. library: 'ClassicEditor', path: path.resolve(__dirname, 'build'), filename: 'ckeditor.js', libraryTarget: 'umd', libraryExport: 'default' }, mode: 'development', optimization: { minimize: false, minimizer: [ new TerserWebpackPlugin( { sourceMap: false, terserOptions: { output: { // Preserve CKEditor 5 license comments. // comments: /^!/ } }, // extractComments: false } ) ] }, plugins: [ new CKEditorTranslationsPlugin({ // The main language that will be built into the main bundle. language: 'fr', // Additional languages that will be emitted to the `outputDirectory`. // This option can be set to an array of language codes or `'all'` to build all found languages. // The bundle is optimized for one language when this option is omitted. additionalLanguages: 'all', // For more advanced options see https://github.com/ckeditor/ckeditor5-dev/tree/master/packages/ckeditor5-dev-translations. }), new webpack.BannerPlugin({ banner: bundler.getLicenseBanner(), raw: true }), new MiniCssExtractPlugin({ filename: 'styles.css' }) ], module: { rules: [ { test: /\.svg$/, use: ['raw-loader'] }, { test: /\.css$/, use: [ MiniCssExtractPlugin.loader, { loader: 'css-loader' }, { loader: 'postcss-loader', options: { postcssOptions: styles.getPostCssConfig({ themeImporter: { themePath: require.resolve('@ckeditor/ckeditor5-theme-lark') }, minify: false }) } }, ] } ] } };