diff options
author | polo <ordipolo@gmx.fr> | 2021-04-20 21:46:33 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2021-04-20 21:46:33 +0200 |
commit | 87798e5554eb0330cd2de255e5034f0472d410a4 (patch) | |
tree | acd9e26a7d912c7575cb6dd1c7b42cc3e9f52993 /lib/ckeditor5/webpack.config.js | |
download | melaine-87798e5554eb0330cd2de255e5034f0472d410a4.zip |
mot de passe
Diffstat (limited to 'lib/ckeditor5/webpack.config.js')
-rw-r--r-- | lib/ckeditor5/webpack.config.js | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/lib/ckeditor5/webpack.config.js b/lib/ckeditor5/webpack.config.js new file mode 100644 index 0000000..4c7efd3 --- /dev/null +++ b/lib/ckeditor5/webpack.config.js | |||
@@ -0,0 +1,96 @@ | |||
1 | /** | ||
2 | * @license Copyright (c) 2014-2021, CKSource - Frederico Knabben. All rights reserved. | ||
3 | * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
4 | */ | ||
5 | |||
6 | 'use strict'; | ||
7 | |||
8 | /* eslint-env node */ | ||
9 | |||
10 | const path = require( 'path' ); | ||
11 | const webpack = require( 'webpack' ); | ||
12 | const { bundler, styles } = require( '@ckeditor/ckeditor5-dev-utils' ); | ||
13 | const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' ); | ||
14 | const TerserWebpackPlugin = require( 'terser-webpack-plugin' ); | ||
15 | |||
16 | module.exports = { | ||
17 | devtool: 'source-map', | ||
18 | performance: { hints: false }, | ||
19 | |||
20 | entry: path.resolve( __dirname, 'src', 'ckeditor.js' ), | ||
21 | |||
22 | output: { | ||
23 | // The name under which the editor will be exported. | ||
24 | library: 'ClassicEditor', | ||
25 | |||
26 | path: path.resolve( __dirname, 'build' ), | ||
27 | filename: 'ckeditor.js', | ||
28 | libraryTarget: 'umd', | ||
29 | libraryExport: 'default' | ||
30 | }, | ||
31 | |||
32 | optimization: { | ||
33 | minimizer: [ | ||
34 | new TerserWebpackPlugin( { | ||
35 | sourceMap: true, | ||
36 | terserOptions: { | ||
37 | output: { | ||
38 | // Preserve CKEditor 5 license comments. | ||
39 | comments: /^!/ | ||
40 | } | ||
41 | }, | ||
42 | extractComments: false | ||
43 | } ) | ||
44 | ] | ||
45 | }, | ||
46 | |||
47 | plugins: [ | ||
48 | new CKEditorWebpackPlugin( { | ||
49 | // UI language. Language codes follow the https://en.wikipedia.org/wiki/ISO_639-1 format. | ||
50 | // When changing the built-in language, remember to also change it in the editor's configuration (src/ckeditor.js). | ||
51 | language: 'fr', | ||
52 | additionalLanguages: 'all' | ||
53 | } ), | ||
54 | new webpack.BannerPlugin( { | ||
55 | banner: bundler.getLicenseBanner(), | ||
56 | raw: true | ||
57 | } ) | ||
58 | ], | ||
59 | |||
60 | module: { | ||
61 | rules: [ | ||
62 | { | ||
63 | test: /\.svg$/, | ||
64 | use: [ 'raw-loader' ] | ||
65 | }, | ||
66 | { | ||
67 | test: /\.css$/, | ||
68 | use: [ | ||
69 | { | ||
70 | loader: 'style-loader', | ||
71 | options: { | ||
72 | injectType: 'singletonStyleTag', | ||
73 | attributes: { | ||
74 | 'data-cke': true | ||
75 | } | ||
76 | } | ||
77 | }, | ||
78 | { | ||
79 | loader: 'css-loader' | ||
80 | }, | ||
81 | { | ||
82 | loader: 'postcss-loader', | ||
83 | options: { | ||
84 | postcssOptions: styles.getPostCssConfig( { | ||
85 | themeImporter: { | ||
86 | themePath: require.resolve( '@ckeditor/ckeditor5-theme-lark' ) | ||
87 | }, | ||
88 | minify: true | ||
89 | } ) | ||
90 | } | ||
91 | }, | ||
92 | ] | ||
93 | } | ||
94 | ] | ||
95 | } | ||
96 | }; | ||