-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
126 lines (116 loc) · 3.02 KB
/
webpack.config.ts
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import { join, resolve } from 'path';
import {
createHtmlWebpackPlugin,
createBundleAnalyzerPlugin,
recommendedRules,
//recommendedWebcomponentRules,
createOutput,
CopyPlugin,
Configuration,
distPath,
} from '@pshaw/webpack';
const projectResolve = (projectDirPath, packageDir) =>
join(projectDirPath, 'javascript', packageDir);
const packagesDir = resolve(__dirname, './packages');
const miscDir = resolve(packagesDir, './misc');
const patrickShawDir = resolve(packagesDir, './patrick-shaw');
const pageBreakerDir = projectResolve(miscDir, 'page-breaker-chrome');
const resumeDir = projectResolve(patrickShawDir, 'my-resume');
const createDistOutput = (packageDir: string) => {
return createOutput(distPath(packageDir));
};
/*const webcomponentsSassModulesRule = {
test: /\.(sass|scss)$/,
use: [cssModuleLoader, sassLoader],
};*/
const pageBreakerFrontendConfig: Configuration = {
name: 'page-breaker',
target: 'web',
devtool: 'eval-source-map',
module: {
rules: recommendedRules,
},
entry: resolve(pageBreakerDir, 'src/index.tsx'),
output: createDistOutput(pageBreakerDir),
plugins: [
createHtmlWebpackPlugin({
title: `Page Breaker`,
}),
new CopyPlugin({
patterns: [
{
from: resolve(pageBreakerDir, 'src/manifest.json'),
to: resolve(pageBreakerDir, 'dist/manifest.json'),
},
{
from: resolve(pageBreakerDir, 'src/icon.png'),
to: resolve(pageBreakerDir, 'dist/icon.png'),
},
],
}),
],
devServer: {
port: 3002,
compress: true,
},
};
const resumeConfig: Configuration = {
name: 'my-resume',
target: 'web',
module: {
rules: recommendedRules,
},
entry: resolve(resumeDir, 'src/index.tsx'),
output: createDistOutput(resumeDir),
plugins: [
createHtmlWebpackPlugin({
title: 'Patrick Shaw - Resume',
}),
createBundleAnalyzerPlugin(resumeDir),
],
devServer: {
port: 3000,
compress: true,
},
};
const geneticSequenceAnalysisAppDir = projectResolve(
miscDir,
'genetic-sequence-analysis-app',
);
const geneticSequenceAnalysisApp: Configuration = {
name: 'genetic-sequence-analysis-app',
target: 'web',
devtool: 'eval-source-map',
module: {
rules: recommendedRules,
},
entry: resolve(geneticSequenceAnalysisAppDir, 'src/index.tsx'),
output: createDistOutput(pageBreakerDir),
plugins: [
createHtmlWebpackPlugin({
title: `Genetic Sequence Analysis`,
}),
new CopyPlugin({
patterns: [
{
from: resolve(geneticSequenceAnalysisAppDir, 'src/manifest.json'),
to: resolve(geneticSequenceAnalysisAppDir, 'dist/manifest.json'),
},
{
from: resolve(geneticSequenceAnalysisAppDir, 'src/icon.png'),
to: resolve(geneticSequenceAnalysisAppDir, 'dist/icon.png'),
},
],
}),
],
devServer: {
port: 3003,
compress: true,
},
};
const configs: Configuration[] = [
resumeConfig,
pageBreakerFrontendConfig,
geneticSequenceAnalysisApp,
];
export default configs;