-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
30 lines (24 loc) · 884 Bytes
/
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
const { resolve } = require('path');
const { appRepositoryRelativePath: appRepositoryPath } = require('./local.config.json');
const baseConfig = require('./webpack.config.base.js');
const hotExtension = require('./webpack.config.hot.js');
const rules = require('./webpack.config.rules.js');
module.exports = (env, { mode }) => {
const { packageName, watchToApp, isNodeTarget } = env;
const isProductionMode = mode === 'production';
const packagePath = resolve(__dirname, `./packages/${packageName}/src/`);
process.env.NODE_ENV = 'production';
const options = {
appRepositoryPath,
packageName,
packagePath,
watchToApp
};
const config = baseConfig({
isProductionMode,
isNodeTarget,
...options,
rules: rules(options)
});
return isProductionMode ? config : hotExtension(config);
};