-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
91 lines (81 loc) · 1.74 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
'use strict';
const { resolve: resolvePath } = require( 'path' );
const TerserWebpackPlugin = require( 'terser-webpack-plugin' );
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyPlugin = require( 'copy-webpack-plugin' );
const srcPath = resolvePath( __dirname, 'src' );
const distPath = resolvePath( __dirname, 'dist' );
module.exports = {
mode: 'production',
devtool: 'source-map',
performance: {
hints: false
},
entry: resolvePath( srcPath, 'index.js' ),
output: {
path: distPath,
filename: 'app.js',
libraryTarget: 'umd'
},
optimization: {
minimizer: [
new TerserWebpackPlugin( {
sourceMap: true,
terserOptions: {
output: {
// Preserve license comments.
comments: /^!/
}
}
} )
]
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
compact: false,
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
targets: {
browsers: [
'last 2 versions',
'ie 11'
],
node: 12
}
}
]
]
}
}
]
},
plugins: [
new CleanWebpackPlugin(),
new CopyPlugin( {
patterns: [
{
from: '{config.js,contents.css,styles.js,adapters/**/*,lang/**/*,plugins/**/*,skins/**/*,vendor/**/*}',
to: resolvePath( distPath, 'ckeditor4' ),
context: resolvePath( __dirname, 'node_modules', 'ckeditor4' )
},
{
from: resolvePath( srcPath, 'index.html' ),
to: distPath
}
]
} )
]
};