forked from Automattic/jetpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.search.js
52 lines (48 loc) · 1.17 KB
/
webpack.config.search.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
/**
* External dependencies
*/
const getBaseWebpackConfig = require( '@automattic/calypso-build/webpack.config.js' );
const path = require( 'path' );
const isDevelopment = process.env.NODE_ENV !== 'production';
const baseWebpackConfig = getBaseWebpackConfig(
{ WP: false },
{
entry: {}, // We'll override later
'output-filename': '[name].js',
'output-path': path.join( __dirname, '_inc', 'build' ),
}
);
const sharedWebpackConfig = {
...baseWebpackConfig,
resolve: {
...baseWebpackConfig.resolve,
modules: [ path.resolve( __dirname, '_inc/client' ), 'node_modules' ],
},
node: {
fs: 'empty',
process: true,
},
devtool: isDevelopment ? 'source-map' : false,
};
module.exports = [
{
...sharedWebpackConfig,
entry: { search: path.join( __dirname, './modules/search/instant-search/index.jsx' ) },
output: {
...sharedWebpackConfig.output,
path: path.join( __dirname, '_inc/build/instant-search' ),
filename: 'jp-search.bundle.js',
},
performance: isDevelopment
? {
maxAssetSize: 500000,
maxEntrypointSize: 500000,
hints: 'error',
}
: {
maxAssetSize: 71680,
maxEntrypointSize: 71680,
hints: 'error',
},
},
];