forked from cerner/terra-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
48 lines (44 loc) · 1.18 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* eslint-disable import/no-extraneous-dependencies */
const { merge } = require('webpack-merge');
const path = require('path');
const {
TerraDevSite,
TerraDevSiteEntrypoints,
DirectorySwitcherPlugin,
LocalPackageAliasPlugin,
} = require('terra-dev-site');
const WebpackConfigTerra = require('@cerner/webpack-config-terra');
/**
* Generates the file representing app name configuration.
*/
const devSiteConfig = (env = {}, argv = { p: false }) => {
const production = argv.p;
const processPath = process.cwd();
return {
entry: TerraDevSiteEntrypoints,
plugins: [
new TerraDevSite({ env }),
],
resolve: {
plugins: [
new DirectorySwitcherPlugin({
shouldSwitch: !production,
rootDirectories: [
processPath,
path.resolve(processPath, 'packages', '*'),
],
}),
new LocalPackageAliasPlugin({
rootDirectories: [
processPath,
path.resolve(processPath, 'packages', '*'),
],
}),
],
},
};
};
const webpackConfig = (env, argv) => (
merge(WebpackConfigTerra(env, argv), devSiteConfig(env, argv))
);
module.exports = webpackConfig;