-
Notifications
You must be signed in to change notification settings - Fork 120
/
webpack.common.mjs
219 lines (215 loc) · 9.16 KB
/
webpack.common.mjs
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
import path from 'path';
import url from 'url';
import { merge } from 'webpack-merge';
import nodeExternals from 'webpack-node-externals';
// eslint-disable-next-line no-underscore-dangle
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const config = {
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules[/\\](?!react-dnd|dnd-core)/,
use: {
loader: 'babel-loader',
options: {
configFile: path.resolve(__dirname, 'babel.config.mjs'),
},
},
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
},
},
{
test: /\.(css|less)$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.b64$/,
use: 'raw-loader',
},
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
],
},
devtool: 'source-map',
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'],
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
},
};
export const clientConfig = merge(config, {
entry: {
BlogPostPage: './src/pages/BlogPostPage.js',
BulkUploadPage: './src/pages/BulkUploadPage.js',
CubeSamplePackPage: './src/pages/CubeSamplePackPage.js',
CubeAnalysisPage: './src/pages/CubeAnalysisPage.js',
CubeBlogPage: './src/pages/CubeBlogPage.js',
CubeComparePage: './src/pages/CubeComparePage.tsx',
CubeDeckPage: './src/pages/CubeDeckPage.js',
CubeDecksPage: './src/pages/CubeDecksPage.js',
CubeDeckbuilderPage: './src/pages/CubeDeckbuilderPage.js',
CubeDraftPage: './src/pages/CubeDraftPage.js',
CubeListPage: './src/pages/CubeListPage.js',
CubeHistoryPage: './src/pages/CubeHistoryPage.js',
CubeOverviewPage: './src/pages/CubeOverviewPage.js',
CubePlaytestPage: './src/pages/CubePlaytestPage.js',
DashboardPage: './src/pages/DashboardPage.js',
GridDraftPage: './src/pages/GridDraftPage.js',
DevBlog: './src/pages/DevBlog.js',
ContactPage: './src/pages/ContactPage.js',
DonatePage: './src/pages/DonatePage.js',
InfoPage: './src/pages/InfoPage.js',
FiltersPage: './src/pages/FiltersPage.js',
DownTimePage: './src/pages/DownTimePage.js',
ErrorPage: './src/pages/ErrorPage.js',
CardSearchPage: './src/pages/CardSearchPage.js',
TopCardsPage: './src/pages/TopCardsPage.js',
CardPage: './src/pages/CardPage.js',
CommentPage: './src/pages/CommentPage.js',
LoginPage: './src/pages/LoginPage.js',
RegisterPage: './src/pages/RegisterPage.js',
LostPasswordPage: './src/pages/LostPasswordPage.js',
NotificationsPage: './src/pages/NotificationsPage.js',
PasswordResetPage: './src/pages/PasswordResetPage.js',
UserAccountPage: './src/pages/UserAccountPage.js',
UserBlogPage: './src/pages/UserBlogPage.js',
UserDecksPage: './src/pages/UserDecksPage.js',
UserSocialPage: './src/pages/UserSocialPage.js',
UserCubePage: './src/pages/UserCubePage.js',
ExplorePage: './src/pages/ExplorePage.js',
SearchPage: './src/pages/SearchPage.js',
RecentDraftsPage: './src/pages/RecentDraftsPage.js',
VersionPage: './src/pages/VersionPage.js',
LandingPage: './src/pages/LandingPage.tsx',
AdminDashboardPage: './src/pages/AdminDashboardPage.js',
NoticePage: './src/pages/NoticePage.js',
ApplicationPage: './src/pages/ApplicationPage.js',
CreatorsPage: './src/pages/CreatorsPage.js',
MarkdownPage: './src/pages/MarkdownPage.js',
EditArticlePage: './src/pages/EditArticlePage.js',
ArticlePage: './src/pages/ArticlePage.js',
ReviewContentPage: './src/pages/ReviewContentPage.js',
ArticlesPage: './src/pages/ArticlesPage.js',
EditVideoPage: './src/pages/EditVideoPage.js',
VideoPage: './src/pages/VideoPage.js',
VideosPage: './src/pages/VideosPage.js',
EditPodcastPage: './src/pages/EditPodcastPage.js',
PodcastPage: './src/pages/PodcastPage.js',
PodcastsPage: './src/pages/PodcastsPage.js',
PodcastEpisodePage: './src/pages/PodcastEpisodePage.js',
BrowseContentPage: './src/pages/BrowseContentPage.js',
LeaveWarningPage: './src/pages/LeaveWarningPage.js',
ApprovedPackagesPage: './src/pages/ApprovedPackagesPage.js',
SubmittedPackagesPage: './src/pages/SubmittedPackagesPage.js',
UserPackagesPage: './src/pages/UserPackagesPage.js',
PackagePage: './src/pages/PackagePage.js',
FeaturedCubesQueuePage: './src/pages/FeaturedCubesQueuePage.js',
},
output: {
filename: '[name].bundle.js',
sourceMapFilename: '[name].js.map',
path: path.resolve(__dirname, 'dist'),
},
externals: {
react: 'React',
'react-dom': 'ReactDOM',
},
});
export const serverConfig = merge(config, {
target: 'node',
entry: {
'pages/DashboardPage': './src/pages/DashboardPage.js',
'pages/DevBlog': './src/pages/DevBlog.js',
'pages/Loading': './src/pages/Loading.js',
'pages/BlogPostPage': './src/pages/BlogPostPage.js',
'pages/BulkUploadPage': './src/pages/BulkUploadPage.js',
'pages/CubeAnalysisPage': './src/pages/CubeAnalysisPage.js',
'pages/CubeBlogPage': './src/pages/CubeBlogPage.js',
'pages/CubeComparePage': './src/pages/CubeComparePage.tsx',
'pages/CubeDeckPage': './src/pages/CubeDeckPage.js',
'pages/CubeDeckbuilderPage': './src/pages/CubeDeckbuilderPage.js',
'pages/CubeDecksPage': './src/pages/CubeDecksPage.js',
'pages/CubeDraftPage': './src/pages/CubeDraftPage.js',
'pages/CubeListPage': './src/pages/CubeListPage.js',
'pages/CubeHistoryPage': './src/pages/CubeHistoryPage.js',
'pages/CubeOverviewPage': './src/pages/CubeOverviewPage.js',
'pages/CubePlaytestPage': './src/pages/CubePlaytestPage.js',
'pages/CubeSamplePackPage': './src/pages/CubeSamplePackPage.js',
'pages/GridDraftPage': './src/pages/GridDraftPage.js',
'pages/ContactPage': './src/pages/ContactPage.js',
'pages/InfoPage': './src/pages/InfoPage.js',
'pages/DonatePage': './src/pages/DonatePage.js',
'pages/DownTimePage': './src/pages/DownTimePage.js',
'pages/FiltersPage': './src/pages/FiltersPage.js',
'pages/ErrorPage': './src/pages/ErrorPage.js',
'pages/CardSearchPage': './src/pages/CardSearchPage.js',
'pages/TopCardsPage': './src/pages/TopCardsPage.js',
'pages/CardPage': './src/pages/CardPage.js',
'pages/CommentPage': './src/pages/CommentPage.js',
'pages/LoginPage': './src/pages/LoginPage.js',
'pages/RegisterPage': './src/pages/RegisterPage.js',
'pages/LostPasswordPage': './src/pages/LostPasswordPage.js',
'pages/NotificationsPage': './src/pages/NotificationsPage.js',
'pages/PasswordResetPage': './src/pages/PasswordResetPage.js',
'pages/UserAccountPage': './src/pages/UserAccountPage.js',
'pages/UserBlogPage': './src/pages/UserBlogPage.js',
'pages/UserDecksPage': './src/pages/UserDecksPage.js',
'pages/UserSocialPage': './src/pages/UserSocialPage.js',
'pages/UserCubePage': './src/pages/UserCubePage.js',
'pages/ExplorePage': './src/pages/ExplorePage.js',
'pages/SearchPage': './src/pages/SearchPage.js',
'pages/RecentDraftsPage': './src/pages/RecentDraftsPage.js',
'pages/VersionPage': './src/pages/VersionPage.js',
'pages/LandingPage': './src/pages/LandingPage.tsx',
'pages/AdminDashboardPage': './src/pages/AdminDashboardPage.js',
'pages/NoticePage': './src/pages/NoticePage.js',
'pages/ApplicationPage': './src/pages/ApplicationPage.js',
'pages/CreatorsPage': './src/pages/CreatorsPage.js',
'pages/MarkdownPage': './src/pages/MarkdownPage.js',
'pages/ArticlePage': './src/pages/ArticlePage.js',
'pages/EditArticlePage': './src/pages/EditArticlePage.js',
'pages/ReviewContentPage': './src/pages/ReviewContentPage.js',
'pages/ArticlesPage': './src/pages/ArticlesPage.js',
'pages/VideoPage': './src/pages/VideoPage.js',
'pages/EditVideoPage': './src/pages/EditVideoPage.js',
'pages/VideosPage': './src/pages/VideosPage.js',
'pages/PodcastPage': './src/pages/PodcastPage.js',
'pages/EditPodcastPage': './src/pages/EditPodcastPage.js',
'pages/PodcastsPage': './src/pages/PodcastsPage.js',
'pages/PodcastEpisodePage': './src/pages/PodcastEpisodePage.js',
'pages/BrowseContentPage': './src/pages/BrowseContentPage.js',
'pages/LeaveWarningPage': './src/pages/LeaveWarningPage.js',
'pages/ApprovedPackagesPage': './src/pages/ApprovedPackagesPage.js',
'pages/SubmittedPackagesPage': './src/pages/SubmittedPackagesPage.js',
'pages/UserPackagesPage': './src/pages/UserPackagesPage.js',
'pages/PackagePage': './src/pages/PackagePage.js',
'pages/FeaturedCubesQueuePage': './src/pages/FeaturedCubesQueuePage.js',
'drafting/createdraft': './src/drafting/createdraft.js',
'drafting/draftutil': './src/drafting/draftutil.js',
'filtering/FilterCards': './src/filtering/FilterCards.ts',
'utils/Card': './src/utils/Card.ts',
'utils/Sort': './src/utils/Sort.ts',
'utils/Util': './src/utils/Util.ts',
'markdown/parser': './src/markdown/parser.js',
},
output: {
filename: '[name].js',
sourceMapFilename: '[name].js.map',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'commonjs2',
},
externals: [
nodeExternals({
allowlist: [],
}),
],
});