gogoclient 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/components/AuthWrapper.js +61 -0
- package/dist/components/PageLayout.js +53 -0
- package/dist/components/RequireAuth.js +86 -0
- package/dist/components/index.js +27 -0
- package/dist/helpers/Root.js +206 -0
- package/dist/helpers/SubscriptionManager.js +61 -0
- package/dist/helpers/currentUserContext.js +12 -0
- package/dist/helpers/currentUserQuery.js +11 -0
- package/dist/helpers/getUrl.js +18 -0
- package/dist/helpers/sentry.js +25 -0
- package/dist/helpers/startClient.js +25 -0
- package/dist/helpers/subscriptionManagerContext.js +22 -0
- package/dist/index.js +109 -0
- package/dist/pages/ProviderConnection.page.js +99 -0
- package/dist/pages/ProviderConnection.queries.js +12 -0
- package/dist/pages/index.js +28 -0
- package/dist/theme/elements/Action.js +29 -0
- package/dist/theme/elements/ActionGroup.js +14 -0
- package/dist/theme/elements/AppBar.js +17 -0
- package/dist/theme/elements/Button.js +31 -0
- package/dist/theme/elements/Checkbox.js +38 -0
- package/dist/theme/elements/GlobalStyle.js +10 -0
- package/dist/theme/elements/Logo.js +10 -0
- package/dist/theme/elements/Menu.js +15 -0
- package/dist/theme/elements/Radio.js +27 -0
- package/dist/theme/elements/TextField.js +39 -0
- package/dist/theme/elements/index.js +76 -0
- package/dist/theme/index.js +93 -0
- package/dist/toolkit/darkenLighten.js +57 -0
- package/dist/toolkit/headingScale.js +29 -0
- package/dist/toolkit/index.js +79 -0
- package/dist/toolkit/media.js +23 -0
- package/dist/toolkit/override.js +74 -0
- package/dist/toolkit/styles/fadeInOut.js +11 -0
- package/dist/toolkit/styles/rotate360.js +11 -0
- package/dist/toolkit/themeHelper.js +53 -0
- package/dist/ui/_helpers/_helpers.js +69 -0
- package/dist/ui/_helpers/cssSnippets.js +11 -0
- package/dist/ui/_helpers/index.js +40 -0
- package/dist/ui/_helpers/useBreakpoint.js +35 -0
- package/dist/ui/assignReviewers/AssignReviewers.js +174 -0
- package/dist/ui/assignReviewers/InviteRowProp.js +130 -0
- package/dist/ui/assignReviewers/ReviewerTable.js +268 -0
- package/dist/ui/assignReviewers/SearchBox.js +160 -0
- package/dist/ui/assignReviewers/SuggestedReviewer.js +28 -0
- package/dist/ui/assignReviewers/index.js +13 -0
- package/dist/ui/authentication/AuthenticationForm.js +87 -0
- package/dist/ui/authentication/AuthenticationHeader.js +13 -0
- package/dist/ui/authentication/AuthenticationWrapper.js +13 -0
- package/dist/ui/authentication/ChangePassword.js +128 -0
- package/dist/ui/authentication/DeactivatedUser.js +17 -0
- package/dist/ui/authentication/Login.js +74 -0
- package/dist/ui/authentication/ProfileForm.js +79 -0
- package/dist/ui/authentication/ProviderConnection.js +69 -0
- package/dist/ui/authentication/RequestPasswordReset.js +89 -0
- package/dist/ui/authentication/ResetPassword.js +96 -0
- package/dist/ui/authentication/Signup.js +180 -0
- package/dist/ui/authentication/SuccessSubTitle.js +20 -0
- package/dist/ui/authentication/VerifyCheck.js +55 -0
- package/dist/ui/authentication/VerifyEmail.js +119 -0
- package/dist/ui/authentication/index.js +104 -0
- package/dist/ui/chat/ChatInput.js +63 -0
- package/dist/ui/chat/ChatMessage.js +67 -0
- package/dist/ui/chat/ChatMessageList.js +45 -0
- package/dist/ui/chat/ChatThread.js +41 -0
- package/dist/ui/chat/index.js +34 -0
- package/dist/ui/common/AutoComplete.js +56 -0
- package/dist/ui/common/Button.js +83 -0
- package/dist/ui/common/ButtonGroup.js +58 -0
- package/dist/ui/common/Checkbox.js +30 -0
- package/dist/ui/common/CheckboxGroup.js +42 -0
- package/dist/ui/common/CokoLink.js +24 -0
- package/dist/ui/common/Collapse.js +14 -0
- package/dist/ui/common/DateParser.js +49 -0
- package/dist/ui/common/Divider.js +8 -0
- package/dist/ui/common/Empty.js +14 -0
- package/dist/ui/common/Form.js +216 -0
- package/dist/ui/common/FormSection.js +35 -0
- package/dist/ui/common/Headings.js +74 -0
- package/dist/ui/common/Input.js +72 -0
- package/dist/ui/common/InputNumber.js +54 -0
- package/dist/ui/common/InviteStatus.js +63 -0
- package/dist/ui/common/Layout.js +17 -0
- package/dist/ui/common/LinkWithoutStyles.js +12 -0
- package/dist/ui/common/List.js +390 -0
- package/dist/ui/common/Modal.js +17 -0
- package/dist/ui/common/Note.js +23 -0
- package/dist/ui/common/Page.js +33 -0
- package/dist/ui/common/Pagination.js +126 -0
- package/dist/ui/common/Popup.js +146 -0
- package/dist/ui/common/Radio.js +54 -0
- package/dist/ui/common/Result.js +8 -0
- package/dist/ui/common/Ribbon.js +54 -0
- package/dist/ui/common/Search.js +30 -0
- package/dist/ui/common/Select.js +148 -0
- package/dist/ui/common/Spin.js +87 -0
- package/dist/ui/common/Split.js +49 -0
- package/dist/ui/common/Status.js +53 -0
- package/dist/ui/common/Switch.js +47 -0
- package/dist/ui/common/Table.js +111 -0
- package/dist/ui/common/Tabs.js +8 -0
- package/dist/ui/common/TabsStyled.js +65 -0
- package/dist/ui/common/TextArea.js +29 -0
- package/dist/ui/common/Typography.js +9 -0
- package/dist/ui/common/VisuallyHiddenElement.js +17 -0
- package/dist/ui/common/_reusableStyles.js +14 -0
- package/dist/ui/common/index.js +341 -0
- package/dist/ui/index.js +49 -0
- package/package.json +114 -0
- package/scripts/coko-client-build.js +42 -0
- package/scripts/coko-client-build.sh +28 -0
- package/scripts/coko-client-dev.js +16 -0
- package/scripts/coko-client-dev.sh +28 -0
- package/scripts/env.sh +41 -0
- package/webpack/changes.md +20 -0
- package/webpack/index.ejs +15 -0
- package/webpack/noop.js +11 -0
- package/webpack/webpack.config.js +483 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang=<%= htmlWebpackPlugin.options.language %>>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
8
|
+
<script src="/env.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</html>
|
package/webpack/noop.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A module that does nothing. Use this as a fallback for files that are
|
|
3
|
+
* optional in webpack's config.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// This can be useful to see if this module actually got used
|
|
7
|
+
// const noop = (() => console.log('the noop!'))()
|
|
8
|
+
|
|
9
|
+
const noop = {}
|
|
10
|
+
|
|
11
|
+
module.exports = noop
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const appRootPath = require('app-root-path')
|
|
3
|
+
const startsWith = require('lodash/startsWith')
|
|
4
|
+
const range = require('lodash/range')
|
|
5
|
+
const has = require('lodash/has')
|
|
6
|
+
const colors = require('colors/safe')
|
|
7
|
+
|
|
8
|
+
const webpack = require('webpack')
|
|
9
|
+
const CompressionPlugin = require('compression-webpack-plugin')
|
|
10
|
+
const CopyPlugin = require('copy-webpack-plugin')
|
|
11
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
12
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
13
|
+
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin')
|
|
14
|
+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
NODE_ENV,
|
|
18
|
+
|
|
19
|
+
CLIENT_APP_ROOT_PATH,
|
|
20
|
+
CLIENT_BUILD_FOLDER_PATH,
|
|
21
|
+
CLIENT_ENTRY_FILE_PATH,
|
|
22
|
+
CLIENT_FAST_REFRESH,
|
|
23
|
+
CLIENT_FAVICON_PATH,
|
|
24
|
+
CLIENT_PAGE_TITLE,
|
|
25
|
+
CLIENT_STATIC_FOLDER_PATH,
|
|
26
|
+
CLIENT_PAGES_FOLDER_PATH,
|
|
27
|
+
CLIENT_PORT,
|
|
28
|
+
CLIENT_UI_FOLDER_PATH,
|
|
29
|
+
CLIENT_LANGUAGE,
|
|
30
|
+
CLIENT_WS_MIN_TIMEOUT,
|
|
31
|
+
CLIENT_WS_TIMEOUT,
|
|
32
|
+
|
|
33
|
+
SERVER_URL,
|
|
34
|
+
WEBSOCKET_SERVER_URL,
|
|
35
|
+
YJS_WEBSOCKET_SERVER_URL,
|
|
36
|
+
|
|
37
|
+
SENTRY_DSN,
|
|
38
|
+
SENTRY_ENVIRONMENT,
|
|
39
|
+
} = process.env
|
|
40
|
+
|
|
41
|
+
//
|
|
42
|
+
/* SET UP VARS */
|
|
43
|
+
//
|
|
44
|
+
|
|
45
|
+
// Environment variables that will only be used in this config
|
|
46
|
+
const variablesForWebpackConfig = [
|
|
47
|
+
'CLIENT_APP_ROOT_PATH',
|
|
48
|
+
'CLIENT_BUILD_FOLDER_PATH',
|
|
49
|
+
'CLIENT_ENTRY_FILE_PATH',
|
|
50
|
+
'CLIENT_FAST_REFRESH',
|
|
51
|
+
'CLIENT_FAVICON_PATH',
|
|
52
|
+
'CLIENT_LANGUAGE',
|
|
53
|
+
'CLIENT_PAGE_TITLE',
|
|
54
|
+
'CLIENT_PAGES_FOLDER_PATH',
|
|
55
|
+
'CLIENT_PORT',
|
|
56
|
+
'CLIENT_STATIC_FOLDER_PATH',
|
|
57
|
+
'CLIENT_UI_FOLDER_PATH',
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* This object maps variables to their default values
|
|
62
|
+
* If a variable is undefined, an error will be thrown
|
|
63
|
+
* Use undefined for required variables, and null or an actual value for optional ones
|
|
64
|
+
* Server url and websocket url are optional because they might not be provided at build time in production,
|
|
65
|
+
* but at runtime with our dynamic url mechanism
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
const DEFAULT_CLIENT_WS_MIN_TIMEOUT = 5000
|
|
69
|
+
const DEFAULT_CLIENT_WS_TIMEOUT = 60000
|
|
70
|
+
|
|
71
|
+
// Environment variables that will be passed down to the build
|
|
72
|
+
const variablesForBuild = {
|
|
73
|
+
NODE_ENV: undefined,
|
|
74
|
+
SERVER_URL: null,
|
|
75
|
+
WEBSOCKET_SERVER_URL: null,
|
|
76
|
+
YJS_WEBSOCKET_SERVER_URL: null,
|
|
77
|
+
SENTRY_DSN: null,
|
|
78
|
+
SENTRY_ENVIRONMENT: null,
|
|
79
|
+
CLIENT_WS_MIN_TIMEOUT: DEFAULT_CLIENT_WS_MIN_TIMEOUT,
|
|
80
|
+
CLIENT_WS_TIMEOUT: DEFAULT_CLIENT_WS_TIMEOUT,
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Allow custom variables that start with CLIENT_ to pass into the build
|
|
84
|
+
const customVariables = Object.keys(process.env)
|
|
85
|
+
.filter(k => {
|
|
86
|
+
return (
|
|
87
|
+
!variablesForWebpackConfig.includes(k) &&
|
|
88
|
+
!has(variablesForBuild, k) &&
|
|
89
|
+
startsWith(k, 'CLIENT_')
|
|
90
|
+
)
|
|
91
|
+
})
|
|
92
|
+
.reduce((obj, k) => {
|
|
93
|
+
const newObj = { ...obj }
|
|
94
|
+
newObj[k] = undefined
|
|
95
|
+
return newObj
|
|
96
|
+
}, {})
|
|
97
|
+
|
|
98
|
+
const variablesInBuild = { ...variablesForBuild, ...customVariables }
|
|
99
|
+
|
|
100
|
+
const mode = NODE_ENV === 'production' ? 'production' : 'development'
|
|
101
|
+
const isEnvDevelopment = mode === 'development'
|
|
102
|
+
const isEnvProduction = mode === 'production'
|
|
103
|
+
|
|
104
|
+
let appPath
|
|
105
|
+
|
|
106
|
+
if (CLIENT_APP_ROOT_PATH) {
|
|
107
|
+
appPath = path.resolve(CLIENT_APP_ROOT_PATH)
|
|
108
|
+
} else {
|
|
109
|
+
appPath = path.resolve(appRootPath.toString(), 'app')
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const uiFolderPath = path.resolve(appPath, CLIENT_UI_FOLDER_PATH || 'ui')
|
|
113
|
+
|
|
114
|
+
const pagesFolderPath = path.resolve(
|
|
115
|
+
appPath,
|
|
116
|
+
CLIENT_PAGES_FOLDER_PATH || 'pages',
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
const noopPath = path.resolve(__dirname, 'noop.js')
|
|
120
|
+
|
|
121
|
+
const staticFolderPath =
|
|
122
|
+
CLIENT_STATIC_FOLDER_PATH || path.resolve(appPath, '..', 'static')
|
|
123
|
+
|
|
124
|
+
const buildFolderPath =
|
|
125
|
+
CLIENT_BUILD_FOLDER_PATH || path.resolve(appPath, '..', '_build')
|
|
126
|
+
|
|
127
|
+
// react's fast-refresh is opt-in for the time being
|
|
128
|
+
const fastRefreshValue =
|
|
129
|
+
CLIENT_FAST_REFRESH && CLIENT_FAST_REFRESH.toString().toLowerCase()
|
|
130
|
+
|
|
131
|
+
const useFastRefresh = fastRefreshValue === '1' || fastRefreshValue === 'true'
|
|
132
|
+
|
|
133
|
+
const templatePath = path.resolve(__dirname, 'index.ejs')
|
|
134
|
+
const entryFilePath = CLIENT_ENTRY_FILE_PATH || './start.js'
|
|
135
|
+
const devServerPort = CLIENT_PORT || 8080
|
|
136
|
+
const faviconPath = CLIENT_FAVICON_PATH
|
|
137
|
+
const pageTitle = CLIENT_PAGE_TITLE
|
|
138
|
+
const language = CLIENT_LANGUAGE
|
|
139
|
+
const defaultLanguage = 'en-US'
|
|
140
|
+
|
|
141
|
+
const serverUrl = SERVER_URL
|
|
142
|
+
const websocketServerUrl = WEBSOCKET_SERVER_URL
|
|
143
|
+
const yjsWebsocketServerUrl = YJS_WEBSOCKET_SERVER_URL
|
|
144
|
+
|
|
145
|
+
const WSLinkMinTimeout = CLIENT_WS_MIN_TIMEOUT || DEFAULT_CLIENT_WS_MIN_TIMEOUT
|
|
146
|
+
const WSLinkTimeout = CLIENT_WS_TIMEOUT || DEFAULT_CLIENT_WS_TIMEOUT
|
|
147
|
+
|
|
148
|
+
// const antVariablesPath = require.resolve(
|
|
149
|
+
// path.join(antPath, 'lib/style/themes/default.less'),
|
|
150
|
+
// )
|
|
151
|
+
|
|
152
|
+
// #region log-init
|
|
153
|
+
/* eslint-disable no-console */
|
|
154
|
+
const symbolGenerator = n => {
|
|
155
|
+
const SYMBOL = '/'
|
|
156
|
+
let symbols = ''
|
|
157
|
+
range(n).forEach(() => (symbols += SYMBOL))
|
|
158
|
+
return symbols
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const cyan = t => console.log(colors.cyan(t))
|
|
162
|
+
|
|
163
|
+
const logSeparator = () => cyan(symbolGenerator(22))
|
|
164
|
+
|
|
165
|
+
const logHeader = text => {
|
|
166
|
+
logSeparator()
|
|
167
|
+
cyan(`${symbolGenerator(2)} ${text.toUpperCase()}\n`)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const logStatus = (label, message, newLine) => {
|
|
171
|
+
console.log(`${colors.cyan(label)}: ${message}${newLine ? '\n' : ''}`)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
logHeader('coko client info')
|
|
175
|
+
logStatus('Environment', NODE_ENV, true)
|
|
176
|
+
logStatus(`App context path is set to`, appPath)
|
|
177
|
+
isEnvProduction && logStatus(`Build will be written to`, buildFolderPath)
|
|
178
|
+
logStatus(`Static folder path found at`, staticFolderPath)
|
|
179
|
+
logStatus(`App entry file will be`, entryFilePath)
|
|
180
|
+
logStatus(`UI folder path will be`, uiFolderPath)
|
|
181
|
+
logStatus(`Pages folder path will be`, pagesFolderPath)
|
|
182
|
+
logStatus(`Favicon path will be`, faviconPath)
|
|
183
|
+
logStatus(`Page title set to`, pageTitle)
|
|
184
|
+
logStatus(`Language set to`, language || `${defaultLanguage} (default)`)
|
|
185
|
+
isEnvDevelopment && logStatus(`Dev server will run at port`, devServerPort)
|
|
186
|
+
logStatus(`Server will be requested at`, serverUrl)
|
|
187
|
+
logStatus(`Websocket server will be requested at`, websocketServerUrl)
|
|
188
|
+
logStatus(`Websocket link min timeout will be `, WSLinkMinTimeout)
|
|
189
|
+
logStatus(`Websocket link timeout will be `, WSLinkTimeout)
|
|
190
|
+
logStatus(`Sentry initialized: `, SENTRY_DSN && SENTRY_ENVIRONMENT)
|
|
191
|
+
logStatus(
|
|
192
|
+
'yjs websocket server url will be requested at',
|
|
193
|
+
yjsWebsocketServerUrl,
|
|
194
|
+
)
|
|
195
|
+
logStatus(`React fast-refresh is`, useFastRefresh ? 'on' : 'off')
|
|
196
|
+
|
|
197
|
+
logStatus(
|
|
198
|
+
'Custom environment variables detected',
|
|
199
|
+
Object.keys(customVariables).length > 0
|
|
200
|
+
? `${Object.keys(customVariables).join(', ')}`
|
|
201
|
+
: 'none',
|
|
202
|
+
true,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
logSeparator()
|
|
206
|
+
console.log('')
|
|
207
|
+
/* eslint-enable no-console */
|
|
208
|
+
// #endregion log-init
|
|
209
|
+
|
|
210
|
+
//
|
|
211
|
+
/* BASE CONFIG */
|
|
212
|
+
//
|
|
213
|
+
|
|
214
|
+
const webpackConfig = {
|
|
215
|
+
context: appPath,
|
|
216
|
+
entry: entryFilePath,
|
|
217
|
+
name: 'client',
|
|
218
|
+
mode,
|
|
219
|
+
// TO DO -- browserlist?
|
|
220
|
+
target: 'web',
|
|
221
|
+
|
|
222
|
+
// TO DO -- bundle analyzer
|
|
223
|
+
output: {
|
|
224
|
+
chunkFilename: isEnvProduction
|
|
225
|
+
? 'js/[name].[contenthash:8].chunk.js'
|
|
226
|
+
: isEnvDevelopment && 'js/[name].chunk.js',
|
|
227
|
+
filename: isEnvProduction ? 'js/[name].[contenthash:8].js' : 'js/[name].js',
|
|
228
|
+
// There are also additional JS chunk files if you use code splitting.
|
|
229
|
+
// path: contentBase,
|
|
230
|
+
path: buildFolderPath,
|
|
231
|
+
// publicPath: isEnvProduction ? '/assets/' : '/',
|
|
232
|
+
publicPath: '/',
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
//
|
|
236
|
+
/* RULES */
|
|
237
|
+
//
|
|
238
|
+
|
|
239
|
+
module: {
|
|
240
|
+
rules: [
|
|
241
|
+
// Typescript
|
|
242
|
+
{ test: /\.tsx?$/, loader: 'ts-loader' },
|
|
243
|
+
|
|
244
|
+
// mjs files: needed because of apollo upload client
|
|
245
|
+
{
|
|
246
|
+
test: /\.m?js/,
|
|
247
|
+
resolve: {
|
|
248
|
+
fullySpecified: false,
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
// js files
|
|
253
|
+
{
|
|
254
|
+
test: /\.js$|\.jsx$/,
|
|
255
|
+
exclude: /node_modules/,
|
|
256
|
+
use: {
|
|
257
|
+
loader: 'babel-loader',
|
|
258
|
+
options: {
|
|
259
|
+
presets: ['@babel/preset-env', '@babel/preset-react'],
|
|
260
|
+
plugins: [
|
|
261
|
+
// ['@babel/plugin-proposal-decorators', { version: '2023-11' }],
|
|
262
|
+
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
263
|
+
'babel-plugin-parameter-decorator',
|
|
264
|
+
['@babel/plugin-transform-class-properties', { loose: true }],
|
|
265
|
+
[
|
|
266
|
+
'@babel/plugin-transform-private-property-in-object',
|
|
267
|
+
{ loose: true },
|
|
268
|
+
],
|
|
269
|
+
['@babel/plugin-transform-private-methods', { loose: true }],
|
|
270
|
+
'@babel/plugin-transform-runtime',
|
|
271
|
+
'babel-plugin-styled-components',
|
|
272
|
+
].filter(Boolean),
|
|
273
|
+
|
|
274
|
+
env: {
|
|
275
|
+
development: {
|
|
276
|
+
plugins: [
|
|
277
|
+
useFastRefresh && require.resolve('react-refresh/babel'),
|
|
278
|
+
].filter(Boolean),
|
|
279
|
+
},
|
|
280
|
+
// TO DO: install babel-preset-minify?
|
|
281
|
+
// production: {
|
|
282
|
+
// /* bug requires mangle:false https://github.com/babel/minify/issues/556#issuecomment-339751209 */
|
|
283
|
+
// presets: [['minify', { builtIns: false, mangle: false }]],
|
|
284
|
+
// },
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
// TO DO -- remove url-loader from dependencies
|
|
291
|
+
|
|
292
|
+
// Images
|
|
293
|
+
{
|
|
294
|
+
test: /\.png|\.jpg|\.svg$/,
|
|
295
|
+
type: 'asset/resource',
|
|
296
|
+
},
|
|
297
|
+
// {
|
|
298
|
+
// test: /\.png|\.jpg$/,
|
|
299
|
+
// loader: 'url-loader',
|
|
300
|
+
// // options: {
|
|
301
|
+
// // limit: 5000,
|
|
302
|
+
// // },
|
|
303
|
+
// },
|
|
304
|
+
|
|
305
|
+
// Fonts
|
|
306
|
+
{
|
|
307
|
+
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
308
|
+
type: 'asset/resource',
|
|
309
|
+
},
|
|
310
|
+
// {
|
|
311
|
+
// test: /\.woff|\.woff2|\.svg|.eot|\.ttf/,
|
|
312
|
+
// loader: 'url-loader',
|
|
313
|
+
// options: {
|
|
314
|
+
// name: 'static/media/[name].[hash:8].[ext]',
|
|
315
|
+
// // fonts break without this line, revisit when webpack dependencies are upgraded
|
|
316
|
+
// esModule: false,
|
|
317
|
+
// },
|
|
318
|
+
// },
|
|
319
|
+
|
|
320
|
+
// HTML
|
|
321
|
+
{ test: /\.html$/, loader: 'html-loader' },
|
|
322
|
+
|
|
323
|
+
// CSS
|
|
324
|
+
{
|
|
325
|
+
test: /\.css$/i,
|
|
326
|
+
use: ['style-loader', 'css-loader'],
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
{
|
|
330
|
+
test: /\.less$/,
|
|
331
|
+
use: [
|
|
332
|
+
{
|
|
333
|
+
loader: 'style-loader',
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
loader: 'css-loader', // translates CSS into CommonJS
|
|
337
|
+
},
|
|
338
|
+
],
|
|
339
|
+
},
|
|
340
|
+
],
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
//
|
|
344
|
+
/* PLUGINS */
|
|
345
|
+
//
|
|
346
|
+
|
|
347
|
+
plugins: [
|
|
348
|
+
// Use the index.ejs template to create the base index.html file of the bundle
|
|
349
|
+
new HtmlWebpackPlugin({
|
|
350
|
+
favicon: faviconPath,
|
|
351
|
+
template: templatePath,
|
|
352
|
+
title: pageTitle,
|
|
353
|
+
language: language || defaultLanguage,
|
|
354
|
+
}),
|
|
355
|
+
|
|
356
|
+
// DEV-ONLY
|
|
357
|
+
// React fast-refresh
|
|
358
|
+
isEnvDevelopment &&
|
|
359
|
+
useFastRefresh &&
|
|
360
|
+
new webpack.HotModuleReplacementPlugin(),
|
|
361
|
+
isEnvDevelopment && useFastRefresh && new ReactRefreshWebpackPlugin(),
|
|
362
|
+
|
|
363
|
+
isEnvDevelopment &&
|
|
364
|
+
new BundleAnalyzerPlugin({
|
|
365
|
+
openAnalyzer: false,
|
|
366
|
+
analyzerHost: '0.0.0.0',
|
|
367
|
+
}),
|
|
368
|
+
|
|
369
|
+
// PROD-ONLY
|
|
370
|
+
isEnvProduction &&
|
|
371
|
+
new MiniCssExtractPlugin({
|
|
372
|
+
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
|
|
373
|
+
filename: 'static/css/[name].[contenthash:8].css',
|
|
374
|
+
}),
|
|
375
|
+
|
|
376
|
+
// Make sure environment variables are defined
|
|
377
|
+
new webpack.EnvironmentPlugin(variablesInBuild),
|
|
378
|
+
|
|
379
|
+
// Copy static assets to root of build folder
|
|
380
|
+
new CopyPlugin({
|
|
381
|
+
patterns: [{ from: staticFolderPath }],
|
|
382
|
+
}),
|
|
383
|
+
|
|
384
|
+
new webpack.optimize.AggressiveMergingPlugin(),
|
|
385
|
+
new CompressionPlugin(),
|
|
386
|
+
|
|
387
|
+
// TO DELETE
|
|
388
|
+
// new webpack.NoEmitOnErrorsPlugin(),
|
|
389
|
+
// new webpack.optimize.OccurrenceOrderPlugin(),
|
|
390
|
+
].filter(Boolean),
|
|
391
|
+
|
|
392
|
+
optimization: {
|
|
393
|
+
splitChunks: {
|
|
394
|
+
chunks: 'all',
|
|
395
|
+
minSize: 20000,
|
|
396
|
+
maxSize: 244000,
|
|
397
|
+
minChunks: 1,
|
|
398
|
+
maxAsyncRequests: 30,
|
|
399
|
+
maxInitialRequests: 30,
|
|
400
|
+
automaticNameDelimiter: '~',
|
|
401
|
+
enforceSizeThreshold: 50000,
|
|
402
|
+
cacheGroups: {
|
|
403
|
+
defaultVendors: {
|
|
404
|
+
test: /[\\/]node_modules[\\/]/,
|
|
405
|
+
priority: -10,
|
|
406
|
+
reuseExistingChunk: true,
|
|
407
|
+
},
|
|
408
|
+
default: {
|
|
409
|
+
minChunks: 2,
|
|
410
|
+
priority: -20,
|
|
411
|
+
reuseExistingChunk: true,
|
|
412
|
+
},
|
|
413
|
+
// Common vendor chunks for better caching
|
|
414
|
+
reactVendor: {
|
|
415
|
+
test: /[\\/]node_modules[\\/](react|react-dom|react-router|react-router-dom)[\\/]/,
|
|
416
|
+
name: 'vendor-react',
|
|
417
|
+
chunks: 'all',
|
|
418
|
+
priority: 0,
|
|
419
|
+
},
|
|
420
|
+
antdVendor: {
|
|
421
|
+
test: /[\\/]node_modules[\\/](antd|@ant-design)[\\/]/,
|
|
422
|
+
name: 'vendor-antd',
|
|
423
|
+
chunks: 'all',
|
|
424
|
+
priority: 0,
|
|
425
|
+
},
|
|
426
|
+
apolloVendor: {
|
|
427
|
+
test: /[\\/]node_modules[\\/](@apollo|graphql|graphql-ws)[\\/]/,
|
|
428
|
+
name: 'vendor-apollo',
|
|
429
|
+
chunks: 'all',
|
|
430
|
+
priority: 0,
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
...(isEnvProduction
|
|
435
|
+
? {
|
|
436
|
+
runtimeChunk: 'single',
|
|
437
|
+
moduleIds: 'deterministic',
|
|
438
|
+
usedExports: true,
|
|
439
|
+
minimize: true,
|
|
440
|
+
}
|
|
441
|
+
: {}),
|
|
442
|
+
},
|
|
443
|
+
|
|
444
|
+
// TO DELETE
|
|
445
|
+
// resolve: {
|
|
446
|
+
// alias: {
|
|
447
|
+
// config: clientConfigPath,
|
|
448
|
+
// joi: 'joi-browser',
|
|
449
|
+
// },
|
|
450
|
+
// enforceExtension: false,
|
|
451
|
+
// extensions: ['.mjs', '.js', '.jsx', '.json', '.scss'],
|
|
452
|
+
// },
|
|
453
|
+
|
|
454
|
+
resolve: {
|
|
455
|
+
alias: {
|
|
456
|
+
pages: pagesFolderPath,
|
|
457
|
+
ui: uiFolderPath,
|
|
458
|
+
},
|
|
459
|
+
fallback: {
|
|
460
|
+
pages: noopPath,
|
|
461
|
+
ui: noopPath,
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (isEnvDevelopment) {
|
|
467
|
+
// TO DO -- use any source map in production?
|
|
468
|
+
webpackConfig.devtool = 'cheap-module-source-map'
|
|
469
|
+
|
|
470
|
+
//
|
|
471
|
+
/* WEBPACK DEV SERVER */
|
|
472
|
+
//
|
|
473
|
+
|
|
474
|
+
webpackConfig.devServer = {
|
|
475
|
+
// handle unknown routes
|
|
476
|
+
historyApiFallback: true,
|
|
477
|
+
// play nice from a within a docker container
|
|
478
|
+
host: '0.0.0.0',
|
|
479
|
+
port: devServerPort,
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
module.exports = webpackConfig
|