@xh/hoist-dev-utils 7.0.0 → 7.2.0
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/README.md +1 -1
- package/configureWebpack.js +18 -21
- package/package.json +18 -19
package/README.md
CHANGED
package/configureWebpack.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file belongs to Hoist, an application development toolkit
|
|
3
3
|
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
4
|
*
|
|
5
|
-
* Copyright ©
|
|
5
|
+
* Copyright © 2024 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
@@ -12,7 +12,6 @@ const _ = require('lodash'),
|
|
|
12
12
|
webpack = require('webpack'),
|
|
13
13
|
BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin,
|
|
14
14
|
CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'),
|
|
15
|
-
{CleanWebpackPlugin} = require('clean-webpack-plugin'),
|
|
16
15
|
CopyWebpackPlugin = require('copy-webpack-plugin'),
|
|
17
16
|
MiniCssExtractPlugin = require('mini-css-extract-plugin'),
|
|
18
17
|
HtmlWebpackPlugin = require('html-webpack-plugin'),
|
|
@@ -102,12 +101,12 @@ try {
|
|
|
102
101
|
* testing on alternate workstations or devices. Will be automatically set to lowercase to comply with
|
|
103
102
|
* webpack-dev-server's host checking. Dev-mode only.
|
|
104
103
|
* @param {number} [env.devGrailsPort] - port of local Grails server. Dev-mode only.
|
|
105
|
-
* @param {number} [env.devWebpackPort] - port on which to start webpack-dev
|
|
104
|
+
* @param {number} [env.devWebpackPort] - port on which to start webpack-dev-server. Dev-mode only.
|
|
106
105
|
* @param {string} [env.devServerOpenPage] - path to auto-open when webpack-dev-server starts. Leave null to disable
|
|
107
106
|
* automatic page open on startup. Dev-mode only.
|
|
108
|
-
* @param {(Object
|
|
109
|
-
*
|
|
110
|
-
*
|
|
107
|
+
* @param {(boolean|Object)} [env.devHttps] - `true` to run webpack-dev-server locally over SSL w/o providing a cert
|
|
108
|
+
* (browser will warn). Or provide an object that will be passed to `devServer.server.options` to enable SSL and
|
|
109
|
+
* while specifying a custom cert/key. Default `false` runs locally over HTTP only. Dev-mode only.
|
|
111
110
|
*/
|
|
112
111
|
async function configureWebpack(env) {
|
|
113
112
|
if (!env.appCode) throw 'Missing required "appCode" config - cannot proceed';
|
|
@@ -129,15 +128,7 @@ async function configureWebpack(env) {
|
|
|
129
128
|
runtimeErrors: false
|
|
130
129
|
},
|
|
131
130
|
devHost = env.devHost ? env.devHost.toLowerCase() : 'localhost',
|
|
132
|
-
devHttps = prodBuild
|
|
133
|
-
? null
|
|
134
|
-
: _.isPlainObject(env.devHttps)
|
|
135
|
-
? {
|
|
136
|
-
ca: fs.readFileSync(env.devHttps.ca),
|
|
137
|
-
cert: fs.readFileSync(env.devHttps.cert),
|
|
138
|
-
key: fs.readFileSync(env.devHttps.key)
|
|
139
|
-
}
|
|
140
|
-
: !!env.devHttps,
|
|
131
|
+
devHttps = prodBuild ? null : _.isPlainObject(env.devHttps) ? env.devHttps : !!env.devHttps,
|
|
141
132
|
devGrailsPort = env.devGrailsPort || 8080,
|
|
142
133
|
devWebpackPort = env.devWebpackPort || 3000,
|
|
143
134
|
baseUrl = env.baseUrl || (prodBuild ? '/api/' : `http://${devHost}:${devGrailsPort}/`),
|
|
@@ -354,7 +345,8 @@ async function configureWebpack(env) {
|
|
|
354
345
|
path: outPath,
|
|
355
346
|
// (URL) path on which fully built app is served - i.e. root context
|
|
356
347
|
publicPath: contextRoot,
|
|
357
|
-
pathinfo: !prodBuild
|
|
348
|
+
pathinfo: !prodBuild,
|
|
349
|
+
clean: true
|
|
358
350
|
},
|
|
359
351
|
|
|
360
352
|
optimization: {
|
|
@@ -608,9 +600,6 @@ async function configureWebpack(env) {
|
|
|
608
600
|
},
|
|
609
601
|
|
|
610
602
|
plugins: [
|
|
611
|
-
// Clean (remove) the output directory before each run.
|
|
612
|
-
new CleanWebpackPlugin(),
|
|
613
|
-
|
|
614
603
|
// Load only the BlueprintJS icons used by Hoist-React components.
|
|
615
604
|
!loadAllBlueprintJsIcons
|
|
616
605
|
? new webpack.NormalModuleReplacementPlugin(
|
|
@@ -628,6 +617,7 @@ async function configureWebpack(env) {
|
|
|
628
617
|
xhAppBuild: JSON.stringify(appBuild),
|
|
629
618
|
xhBaseUrl: JSON.stringify(baseUrl),
|
|
630
619
|
xhBuildTimestamp: buildDate.getTime(),
|
|
620
|
+
xhClientApps: JSON.stringify(appNames),
|
|
631
621
|
xhIsDevelopmentMode: !prodBuild
|
|
632
622
|
}),
|
|
633
623
|
|
|
@@ -659,7 +649,9 @@ async function configureWebpack(env) {
|
|
|
659
649
|
template: path.resolve(hoistPath, `static/index-manifest.html`),
|
|
660
650
|
filename: `${jsAppName}/index.html`,
|
|
661
651
|
// Only include chunks that contain the js app name
|
|
662
|
-
chunks: chunkNames.filter(
|
|
652
|
+
chunks: chunkNames.filter(
|
|
653
|
+
it => it.startsWith(jsAppName) || it.includes('~' + jsAppName)
|
|
654
|
+
),
|
|
663
655
|
// No need to minify the HTML itself
|
|
664
656
|
minify: false,
|
|
665
657
|
// Flag read within template file to include apple icon.
|
|
@@ -726,11 +718,16 @@ async function configureWebpack(env) {
|
|
|
726
718
|
devServer: prodBuild
|
|
727
719
|
? undefined
|
|
728
720
|
: {
|
|
729
|
-
https: devHttps,
|
|
730
721
|
host: devHost,
|
|
731
722
|
port: devWebpackPort,
|
|
732
723
|
hot: true,
|
|
733
724
|
client: {overlay: devClientOverlay},
|
|
725
|
+
server:
|
|
726
|
+
devHttps === true
|
|
727
|
+
? {type: 'https'}
|
|
728
|
+
: _.isPlainObject(devHttps)
|
|
729
|
+
? {type: 'https', options: {...devHttps}}
|
|
730
|
+
: undefined,
|
|
734
731
|
open: env.devServerOpenPage ? [env.devServerOpenPage] : false,
|
|
735
732
|
// Support HTML5 history routes for apps, with /appName/ as the base route for each
|
|
736
733
|
historyApiFallback: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist-dev-utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Utilities for configuring builds of Hoist-React client applications.",
|
|
5
5
|
"repository": "github:xh/hoist-dev-utils",
|
|
6
6
|
"homepage": "https://github.com/xh/hoist-dev-utils",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"static/**/*"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@babel/core": "^7.
|
|
16
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
17
|
-
"@babel/preset-env": "^7.
|
|
18
|
-
"@babel/preset-react": "^7.
|
|
19
|
-
"@babel/preset-typescript": "^7.
|
|
15
|
+
"@babel/core": "^7.23.9",
|
|
16
|
+
"@babel/plugin-proposal-decorators": "^7.23.9",
|
|
17
|
+
"@babel/preset-env": "^7.23.9",
|
|
18
|
+
"@babel/preset-react": "^7.23.3",
|
|
19
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
20
20
|
"@cerner/duplicate-package-checker-webpack-plugin": "~2.3.0",
|
|
21
21
|
"@types/lodash": "4.x",
|
|
22
22
|
"@types/react": "18.x",
|
|
@@ -26,29 +26,28 @@
|
|
|
26
26
|
"babel-plugin-transform-imports": "~2.0.0",
|
|
27
27
|
"case-sensitive-paths-webpack-plugin": "~2.4.0",
|
|
28
28
|
"changelog-parser": "~3.0.1",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"css-loader": "~6.8.1",
|
|
29
|
+
"copy-webpack-plugin": "~12.0.2",
|
|
30
|
+
"css-loader": "~6.10.0",
|
|
32
31
|
"file-loader": "~6.2.0",
|
|
33
|
-
"html-webpack-plugin": "~5.
|
|
32
|
+
"html-webpack-plugin": "~5.6.0",
|
|
34
33
|
"html-webpack-tags-plugin": "~3.0.2",
|
|
35
34
|
"lodash": "~4.17.21",
|
|
36
|
-
"mini-css-extract-plugin": "~2.
|
|
37
|
-
"postcss": "~8.4.
|
|
35
|
+
"mini-css-extract-plugin": "~2.8.0",
|
|
36
|
+
"postcss": "~8.4.33",
|
|
38
37
|
"postcss-flexbugs-fixes": "~5.0.2",
|
|
39
|
-
"postcss-loader": "~
|
|
40
|
-
"rimraf": "~
|
|
41
|
-
"sass": "~1.
|
|
42
|
-
"sass-loader": "~
|
|
38
|
+
"postcss-loader": "~8.1.0",
|
|
39
|
+
"rimraf": "~5.0.5",
|
|
40
|
+
"sass": "~1.70.0",
|
|
41
|
+
"sass-loader": "~14.1.0",
|
|
43
42
|
"sass-material-colors": "~0.0.5",
|
|
44
43
|
"style-loader": "~3.3.2",
|
|
45
44
|
"terser-webpack-plugin": "~5.3.7",
|
|
46
45
|
"url-loader": "~4.1.1",
|
|
47
|
-
"webpack": "~5.
|
|
48
|
-
"webpack-bundle-analyzer": "~4.
|
|
46
|
+
"webpack": "~5.90.1",
|
|
47
|
+
"webpack-bundle-analyzer": "~4.10.1",
|
|
49
48
|
"webpack-cli": "~5.1.4",
|
|
50
49
|
"webpack-dev-server": "~4.15.0",
|
|
51
|
-
"webpackbar": "~
|
|
50
|
+
"webpackbar": "~6.0.0"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"prettier": "3.x"
|