This repository has been archived by the owner on Jul 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
webpack.config.js
75 lines (74 loc) · 1.61 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
const { resolve } = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = [
defaultConfig,
{
...defaultConfig,
entry: {
runtime: './src/runtime',
'e2e/page-1': './e2e/page-1',
'e2e/page-2': './e2e/page-2',
'e2e/directive-priorities': './e2e/js/directive-priorities',
'e2e/directive-bind': './e2e/js/directive-bind',
'e2e/directive-effect': './e2e/js/directive-effect',
'e2e/negation-operator': './e2e/js/negation-operator',
},
output: {
filename: '[name].js',
path: resolve(process.cwd(), 'build'),
library: {
name: '__experimentalInteractivity',
type: 'window',
},
},
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',
},
],
],
},
},
],
},
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
plugins: [new MiniCssExtractPlugin()],
},
];