-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
44 lines (39 loc) · 1.79 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
const { hasArgInCLI, hasBabelConfig } = require('@wordpress/scripts/utils');
const hasReactFastRefresh = hasArgInCLI('--hot') && !isProduction;
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
module.exports = {
...defaultConfig,
module: {
rules: [
...defaultConfig.module.rules, {
test: /\.(j|t)sx?$/,
// exclude: /node_modules/,
// include: [__dirname + '/node_modules/wcl-react-poc/src/'],
include: [__dirname + '/wcl-react-poc/src/'],
use: [
{
loader: require.resolve('babel-loader'),
options: {
// Babel uses a directory within local node_modules
// by default. Use the environment variable option
// to enable more persistent caching.
cacheDirectory: process.env.BABEL_CACHE_DIRECTORY || true,
// Provide a fallback configuration if there's not
// one explicitly available in the project.
...(!hasBabelConfig() && {
babelrc: false,
configFile: false,
presets: [
require.resolve('@wordpress/babel-preset-default'),
],
plugins: [
hasReactFastRefresh && require.resolve('react-refresh/babel'),
].filter(Boolean)
})
}
},
]
},
]
}
};