-
Notifications
You must be signed in to change notification settings - Fork 42
/
webpack.config.babel.js
61 lines (53 loc) · 1.83 KB
/
webpack.config.babel.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
/* eslint global-require: 0 */
/* eslint import/first: 0 */
/* eslint import/newline-after-import: 0 */
/* eslint import/no-extraneous-dependencies: 0 */
import './run/global';
import { match } from 'rfx-core';
import merge from 'webpack-merge';
import Globals from './webpack/globals';
import getLoaders from './webpack/loaders';
let Config;
let Loader = getLoaders();
if (match.script('web:dev', 'development')) {
Config = require('./webpack/config.server').load();
const ConfigServerDev = require('./webpack/config.server.dev');
Loader = merge(Loader, ConfigServerDev.loader());
Config = merge(Config, ConfigServerDev.config('start.web'));
}
if (match.script('build:client:web', 'production')) {
Config = require('./webpack/config.client').load();
const ConfigClientBuild = require('./webpack/config.client.build');
Loader = merge(Loader, ConfigClientBuild.loader());
Config = merge(Config, ConfigClientBuild.config('web'));
}
if (match.script('build:server:web', 'production')) {
Config = require('./webpack/config.server').load();
const ConfigServerBuild = require('./webpack/config.server.build');
Loader = merge(Loader, ConfigServerBuild.loader());
Config = merge(Config, ConfigServerBuild.config('start.web'));
}
if (match.script('build:server:api', 'production')) {
Config = require('./webpack/config.server').load();
const ConfigServerBuild = require('./webpack/config.server.build');
Loader = merge(Loader, ConfigServerBuild.loader());
Config = merge(Config, ConfigServerBuild.config('start.api'));
}
// Globals
Config = merge(Config, Globals);
// Loaders
Config = merge(Config, {
module: {
loaders: [
Loader.eslint,
Loader.jsx,
Loader.json,
Loader.url,
Loader.file,
Loader.cssGlobal,
Loader.cssModules,
],
},
});
const WebpackConfig = Config;
export default WebpackConfig;