Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
/**
2
 * @license Copyright (c) 2014-2023, CKSource Holding sp. z o.o. 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 { CKEditorTranslationsPlugin } = require( '@ckeditor/ckeditor5-dev-translations' );
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.ts' ),
21
 
22
	output: {
23
		// The name under which the editor will be exported.
24
		library: 'ClassicEditor',
25
 
26
		path: path.resolve( __dirname, '..', 'ckeditor' ),
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 CKEditorTranslationsPlugin( {
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.ts).
51
			language: 'en',
52
			additionalLanguages: 'all'
53
		} ),
54
		new webpack.BannerPlugin( {
55
			banner: bundler.getLicenseBanner(),
56
			raw: true
57
		} )
58
	],
59
 
60
	resolve: {
61
		extensions: [ '.ts', '.js', '.json' ]
62
	},
63
 
64
	module: {
65
		rules: [ {
66
			test: /\.svg$/,
67
			use: [ 'raw-loader' ]
68
		}, {
69
			test: /\.ts$/,
70
			use: 'ts-loader'
71
		}, {
72
			test: /\.css$/,
73
			use: [ {
74
				loader: 'style-loader',
75
				options: {
76
					injectType: 'singletonStyleTag',
77
					attributes: {
78
						'data-cke': true
79
					}
80
				}
81
			}, {
82
				loader: 'css-loader'
83
			}, {
84
				loader: 'postcss-loader',
85
				options: {
86
					postcssOptions: styles.getPostCssConfig( {
87
						themeImporter: {
88
							themePath: require.resolve( '@ckeditor/ckeditor5-theme-lark' )
89
						},
90
						minify: true
91
					} )
92
				}
93
			} ]
94
		} ]
95
	}
96
};