-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
58 lines (52 loc) · 1.82 KB
/
index.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
const {
webpackConfiguration,
webpackBuildEngine,
} = require('./services/building');
const {
webpackBaseConfiguration,
webpackBrowserDevelopmentConfiguration,
webpackBrowserProductionConfiguration,
webpackRulesConfiguration,
webpackNodeDevelopmentConfiguration,
webpackNodeProductionConfiguration,
} = require('./services/configurations');
const {
webpackMiddlewares,
} = require('./services/server');
const { name } = require('../package.json');
/**
* This is the method called by projext when loading the plugin. It takes care of registering
* the Webpack build engine service and all the other services the engine depends on.
* @param {Projext} app The projext main container.
* @ignore
*/
const loadPlugin = (app) => {
/**
* This define the basic information of the plugin for other services to use:
* - The name of the plugin.
* - Where the `webpack.config.js` file is located.
* - The subpaths the plugin expose. Since they won't match a dependency on the `package.json`,
* a Node target may want to include them while bundling.
*/
app.set('webpackPluginInfo', () => ({
name,
configuration: 'src/webpack.config.js',
external: [
'express',
'jimpex',
],
}));
// Register the main services of the build engine.
app.register(webpackConfiguration);
app.register(webpackBuildEngine);
// Register the services for building the targets configurations.
app.register(webpackBaseConfiguration);
app.register(webpackBrowserDevelopmentConfiguration);
app.register(webpackBrowserProductionConfiguration);
app.register(webpackRulesConfiguration);
app.register(webpackNodeDevelopmentConfiguration);
app.register(webpackNodeProductionConfiguration);
// Register the service for server integration.
app.register(webpackMiddlewares);
};
module.exports = loadPlugin;