This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
webpack.config.js
72 lines (65 loc) · 1.83 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const path = require('path');
const { merge } = require('webpack-merge');
const {
TerraDevSite,
} = require('@cerner/terra-dev-site');
const WebpackConfigTerra = require('@cerner/webpack-config-terra');
const packageJson = require('./package.json');
const cwd = process.cwd();
const excludes = [
'@cerner/terra-application',
];
const additionalSearchDirectories = Object.keys(packageJson.peerDependencies).reduce((acc, peerDependency) => {
if ((peerDependency.startsWith('terra-') || peerDependency.startsWith('@cerner/terra-')) && !excludes.includes(peerDependency)) {
acc.push(path.join(cwd, 'node_modules', peerDependency, 'lib', 'terra-dev-site'));
}
return acc;
}, []);
const coreConfig = () => ({
plugins: [
new TerraDevSite({
titleConfig: {
title: 'Terra',
},
primaryNavigationItems: [{
path: '/home',
label: 'Home',
contentExtension: 'home',
}, {
path: '/about',
label: 'About',
contentExtension: 'about',
}, {
path: '/application',
label: 'Application',
contentExtension: 'app',
}, {
path: '/components',
label: 'Components',
contentExtension: 'doc',
}, {
path: '/graphs',
label: 'Graphs',
contentExtension: 'graph',
}, {
path: '/dev_tools',
label: 'Developer Tools',
contentExtension: 'tool',
}, {
path: '/guides',
label: 'Guides',
contentExtension: 'guide',
}],
distributionFolder: 'src',
additionalSearchDirectories,
sideEffectImportFilePaths: [
'terra-ui/src/initializeXFC.js',
'terra-ui/src/IllustrationGrid.scss',
],
}),
],
});
const mergedConfig = (env, argv) => (
merge(WebpackConfigTerra(env, argv), coreConfig())
);
module.exports = mergedConfig;