-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.dev
More file actions
46 lines (44 loc) · 1.06 KB
/
Copy pathwebpack.config.dev
File metadata and controls
46 lines (44 loc) · 1.06 KB
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
const defaultConfig = require("@wordpress/scripts/config/webpack.config");
const path = require("path");
const defaultRulesWithoutBabel = defaultConfig.module.rules.filter(
(rule) => !rule.use || !JSON.stringify(rule.use).includes("babel-loader"),
);
module.exports = {
...defaultConfig,
externals: {
react: "React",
"react-dom": "ReactDOM",
},
entry: {
// same like the original
},
output: {
// same like the original
},
module: {
...defaultConfig.module,
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: require.resolve("babel-loader"),
options: {
presets: [
[require.resolve("@babel/preset-env"), { modules: "commonjs" }],
require.resolve("@babel/preset-react"),
],
},
},
},
...defaultRulesWithoutBabel,
],
},
plugins: [...defaultConfig.plugins],
resolve: {
extensions: [".js", ".jsx"],
alias: {
"@": path.resolve(__dirname, "src/admin/dashboard"),
},
},
};