-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
47 lines (40 loc) · 1.22 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
const path = require("path");
const admin = path.join(__dirname, "src", "admin");
const front = path.join(__dirname, "src", "front");
const blocks = path.join(__dirname, "src", "blocks");
const defaultConfig = require("@wordpress/scripts/config/webpack.config");
// Import the helper to find and generate the entry points in the src directory
const { getWebpackEntryPoints } = require("@wordpress/scripts/utils/config");
// Check if it's a production build
const isProduction = process.env.NODE_ENV === "production";
let optimization = defaultConfig.optimization;
if (isProduction) {
optimization = {
...defaultConfig.optimization,
};
}
// Set the devtool based on the build environment
const devtool = isProduction ? false : "source-map";
module.exports = {
...defaultConfig,
entry: {
...getWebpackEntryPoints("script")(),
blocks: blocks,
admin: admin,
front: front,
},
devtool: devtool,
module: {
...defaultConfig.module,
},
// Erweitern Sie die Dateierweiterungen, die Webpack verarbeiten wird
resolve: {
...defaultConfig.resolve,
extensions: [".tsx", ".ts", ".js", ".json"]
},
optimization: optimization,
performance: {
...defaultConfig.performance,
hints: false,
},
};