forked from WordPress/wp-movies-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
59 lines (58 loc) · 1.08 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
48
49
50
51
52
53
54
55
56
57
58
59
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
const { resolve } = require('path');
module.exports = [
defaultConfig,
{
...defaultConfig,
entry: {
'query-loop-variations': './lib/query-loop-variations',
},
output: {
filename: '[name].js',
path: resolve(process.cwd(), 'build'),
},
optimization: {
runtimeChunk: {
name: 'vendors',
},
splitChunks: {
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
minSize: 0,
chunks: 'all',
},
},
},
},
module: {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve('babel-loader'),
options: {
cacheDirectory:
process.env.BABEL_CACHE_DIRECTORY || true,
babelrc: false,
configFile: false,
presets: [
[
'@babel/preset-react',
{
runtime: 'automatic',
importSource: 'preact',
},
],
],
},
},
],
},
],
},
},
];