forked from DotCamp/wp-table-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
30 lines (23 loc) · 729 Bytes
/
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
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
const fs = require('fs');
const path = require('path');
const entryDir = path.resolve(__dirname, 'inc', 'admin', 'js', 'core', 'gutenberg-src');
const outputDir = path.resolve(__dirname, 'inc', 'admin', 'js', 'gutenberg-build');
const entryFiles = fs.readdirSync(entryDir);
const entry = entryFiles.reduce((carry, item) => {
const parsedFile = path.parse(item);
if (parsedFile.ext === '.js') {
// eslint-disable-next-line no-param-reassign
carry[parsedFile.name] = path.resolve(entryDir, item);
}
return carry;
}, {});
const output = {
filename: '[name].js',
path: outputDir,
};
module.exports = {
...defaultConfig,
entry,
output,
};