-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathwebpack.config.js
45 lines (40 loc) · 978 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* `@wordpress/scripts` path-based name multi-block Webpack configuration.
* @see https://wordpress.stackexchange.com/questions/390282
*/
// Native Depedencies.
const path = require("path");
// Third-Party Dependencies.
const CopyPlugin = require("copy-webpack-plugin");
const config = require("@wordpress/scripts/config/webpack.config.js");
config.entry = {
"advanced-levels-page/index": path.resolve(
process.cwd(),
"blocks",
"src",
"advanced-levels-page",
"index.js"
)
};
config.output = {
filename: "[name].js",
path: path.resolve(process.cwd(), "blocks", "build"),
};
// Add a CopyPlugin to copy over block.json files.
config.plugins.push(
new CopyPlugin({
patterns: [
{
context: "blocks/src",
from: `*/block.json`,
noErrorOnMissing: true,
},
{
context: "blocks/src",
from: `*/render.php`,
noErrorOnMissing: true,
},
],
})
);
module.exports = config;