-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwebpack.config.js
More file actions
65 lines (63 loc) · 1.67 KB
/
webpack.config.js
File metadata and controls
65 lines (63 loc) · 1.67 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* WordPress dependencies
*/
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
/**
* External dependencies
*/
const path = require( 'path' );
const chatPackageSrc = path.resolve(
__dirname,
'node_modules/@extrachill/chat/src',
);
module.exports = {
...defaultConfig,
entry: {
'pipelines-react':
'./inc/Core/Admin/Pages/Pipelines/assets/react/index.jsx',
'logs-react': './inc/Core/Admin/Pages/Logs/assets/react/index.jsx',
'settings-react': './inc/Core/Admin/Settings/assets/react/index.jsx',
'agent-react': './inc/Core/Admin/Pages/Agent/assets/react/index.jsx',
'jobs-react': './inc/Core/Admin/Pages/Jobs/assets/react/index.jsx',
},
output: {
...defaultConfig.output,
path: path.resolve( __dirname, 'inc/Core/Admin/assets/build' ),
filename: '[name].js',
},
resolve: {
...defaultConfig.resolve,
alias: {
...( defaultConfig.resolve?.alias || {} ),
'@shared': path.resolve( __dirname, 'inc/Core/Admin/shared' ),
// Resolve @extrachill/chat to source (no dist/ in git-installed package)
'@extrachill/chat': chatPackageSrc + '/index.ts',
},
extensions: [
'.tsx', '.ts',
...( defaultConfig.resolve?.extensions || [ '.jsx', '.js', '.json' ] ),
],
},
module: {
...defaultConfig.module,
rules: [
// TypeScript support for @extrachill/chat source files
{
test: /\.tsx?$/,
include: [ chatPackageSrc ],
use: [
{
loader: require.resolve( 'babel-loader' ),
options: {
presets: [
require.resolve( '@babel/preset-typescript' ),
require.resolve( '@babel/preset-react' ),
],
},
},
],
},
...( defaultConfig.module?.rules || [] ),
],
},
};