-
Notifications
You must be signed in to change notification settings - Fork 116
/
webpack.config.js
56 lines (52 loc) · 1.57 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
/**
* External dependencies
*/
const path = require( 'path' );
const CopyPlugin = require( 'copy-webpack-plugin' );
/**
* WordPress dependencies
*/
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
module.exports = {
...defaultConfig,
entry: {
admin: './src/js/admin.js',
'admin-exclude': './src/js/admin-exclude.js',
'alert-type-highlight': './src/js/alert-type-highlight.js',
alerts: './src/js/alerts.js',
'alerts-list': './src/js/alerts-list.js',
global: './src/js/global.js',
'live-updates': './src/js/live-updates.js',
settings: './src/js/settings.js',
'wpseo-admin': './src/js/wpseo-admin.js',
},
plugins: [
...defaultConfig.plugins,
new CopyPlugin( {
patterns: [
{
from: 'node_modules/select2/dist',
// Convert filenames to lowercase.
to( { context, absoluteFilename } ) {
const baseName = path.basename( absoluteFilename ).toLowerCase();
const relativePath = path.relative( context, path.dirname( absoluteFilename ) );
return path.join( 'select2', relativePath, baseName );
},
},
{
from: 'node_modules/timeago/jquery.timeago.js',
to: 'timeago/js/jquery.timeago.js',
},
{
from: 'node_modules/timeago/locales',
// Convert filenames to lowercase.
to( { context, absoluteFilename } ) {
const baseName = path.basename( absoluteFilename ).toLowerCase();
const relativePath = path.relative( context, path.dirname( absoluteFilename ) );
return path.join( 'timeago', 'js', 'locales', relativePath, baseName );
},
},
],
} ),
],
};