@nx/webpack 19.7.0-beta.1 → 19.7.0-beta.3
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/index.d.ts +1 -0
- package/index.js +1 -0
- package/migrations.json +6 -0
- package/package.json +4 -4
- package/src/executors/webpack/schema.json +4 -0
- package/src/migrations/update-19-6-3/proxy-config.d.ts +2 -0
- package/src/migrations/update-19-6-3/proxy-config.js +57 -0
- package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts +4 -0
- package/src/utils/e2e-web-server-info-utils.d.ts +2 -0
- package/src/utils/e2e-web-server-info-utils.js +25 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -29,3 +29,4 @@ tslib_1.__exportStar(require("./src/utils/get-css-module-local-ident"), exports)
|
|
|
29
29
|
tslib_1.__exportStar(require("./src/utils/with-nx"), exports);
|
|
30
30
|
tslib_1.__exportStar(require("./src/utils/with-web"), exports);
|
|
31
31
|
tslib_1.__exportStar(require("./src/utils/module-federation/public-api"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./src/utils/e2e-web-server-info-utils"), exports);
|
package/migrations.json
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
"version": "17.2.1-beta.0",
|
|
12
12
|
"description": "Add webpack.config.js file when webpackConfig is not defined",
|
|
13
13
|
"implementation": "./src/migrations/update-17-2-1/webpack-config-setup"
|
|
14
|
+
},
|
|
15
|
+
"update-19-6-3-proxy-config": {
|
|
16
|
+
"cli": "nx",
|
|
17
|
+
"version": "19.6.3-beta.0",
|
|
18
|
+
"description": "Migrate proxy config files to match new format from webpack-dev-server v5.",
|
|
19
|
+
"implementation": "./src/migrations/update-19-6-3/proxy-config"
|
|
14
20
|
}
|
|
15
21
|
},
|
|
16
22
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "19.7.0-beta.
|
|
3
|
+
"version": "19.7.0-beta.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Webpack contains executors and generators that support building applications using Webpack.",
|
|
6
6
|
"repository": {
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"webpack-dev-server": "^5.0.4",
|
|
70
70
|
"webpack-node-externals": "^3.0.0",
|
|
71
71
|
"webpack-subresource-integrity": "^5.1.0",
|
|
72
|
-
"@nx/devkit": "19.7.0-beta.
|
|
73
|
-
"@nx/js": "19.7.0-beta.
|
|
74
|
-
"@nrwl/webpack": "19.7.0-beta.
|
|
72
|
+
"@nx/devkit": "19.7.0-beta.3",
|
|
73
|
+
"@nx/js": "19.7.0-beta.3",
|
|
74
|
+
"@nrwl/webpack": "19.7.0-beta.3"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
@@ -163,6 +163,10 @@
|
|
|
163
163
|
"type": "boolean",
|
|
164
164
|
"description": "Generates a `package.json` and pruned lock file with the project's `node_module` dependencies populated for installing in a container. If a `package.json` exists in the project's directory, it will be reused with dependencies populated."
|
|
165
165
|
},
|
|
166
|
+
"skipOverrides": {
|
|
167
|
+
"type": "boolean",
|
|
168
|
+
"description": "Do not add a `overrides` and `resolutions` entries to the generated package.json file. Only works in conjunction with `generatePackageJson` option."
|
|
169
|
+
},
|
|
166
170
|
"skipPackageManager": {
|
|
167
171
|
"type": "boolean",
|
|
168
172
|
"description": "Do not add a `packageManager` entry to the generated package.json file. Only works in conjunction with `generatePackageJson` option."
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
+
async function update(tree) {
|
|
7
|
+
const unmigratedConfigs = [];
|
|
8
|
+
const migrate = (options) => {
|
|
9
|
+
if (!options.proxyConfig)
|
|
10
|
+
return;
|
|
11
|
+
if (options.proxyConfig.endsWith('.json')) {
|
|
12
|
+
(0, devkit_1.updateJson)(tree, options.proxyConfig, (json) => {
|
|
13
|
+
if (Array.isArray(json))
|
|
14
|
+
return json;
|
|
15
|
+
if (typeof json === 'object') {
|
|
16
|
+
return Object.keys(json).map((context) => ({
|
|
17
|
+
context: [context],
|
|
18
|
+
...json[context],
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
return json;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// For non-JSON files, it's not possible to automatically update the proxy config
|
|
26
|
+
// since its content can vary greatly.
|
|
27
|
+
unmigratedConfigs.push(options.proxyConfig);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/webpack:dev-server', migrate);
|
|
31
|
+
// React dev-server calls Webpack dev-server.
|
|
32
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/react:module-federation-dev-server', migrate);
|
|
33
|
+
if (unmigratedConfigs.length > 0) {
|
|
34
|
+
devkit_1.logger.warn(`Some proxy config files need to be updated manually.
|
|
35
|
+
${unmigratedConfigs.join('\n ')}
|
|
36
|
+
|
|
37
|
+
Webpack-dev-server v5 changed the proxy config schema to accept only an array.
|
|
38
|
+
|
|
39
|
+
For example, if you had the following:
|
|
40
|
+
|
|
41
|
+
"proxy": {
|
|
42
|
+
"/api": {
|
|
43
|
+
"target": "http://localhost:3000"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
It needs to be updated to:
|
|
48
|
+
|
|
49
|
+
"proxy": [{
|
|
50
|
+
"context": ["/api"],
|
|
51
|
+
"target": "http://localhost:3000"
|
|
52
|
+
}]
|
|
53
|
+
|
|
54
|
+
More information: https://github.com/webpack/webpack-dev-server/blob/master/migration-v5.md
|
|
55
|
+
`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -158,6 +158,10 @@ export interface NxAppWebpackPluginOptions {
|
|
|
158
158
|
* External scripts that will be included before the main application entry.
|
|
159
159
|
*/
|
|
160
160
|
scripts?: Array<ExtraEntryPointClass | string>;
|
|
161
|
+
/**
|
|
162
|
+
* Do not add a `overrides` and `resolutions` entries to the generated package.json file. Only works in conjunction with `generatePackageJson` option.
|
|
163
|
+
*/
|
|
164
|
+
skipOverrides?: boolean;
|
|
161
165
|
/**
|
|
162
166
|
* Do not add a `packageManager` entry to the generated package.json file. Only works in conjunction with `generatePackageJson` option.
|
|
163
167
|
*/
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
export declare function getWebpackE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number): Promise<import("@nx/devkit/src/generators/e2e-web-server-info-utils").E2EWebServerDetails>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWebpackE2EWebServerInfo = getWebpackE2EWebServerInfo;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
6
|
+
async function getWebpackE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded, e2ePortOverride) {
|
|
7
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
8
|
+
let e2ePort = e2ePortOverride ?? 4200;
|
|
9
|
+
if (nxJson.targetDefaults?.['serve'] &&
|
|
10
|
+
nxJson.targetDefaults?.['serve'].options?.port) {
|
|
11
|
+
e2ePort = nxJson.targetDefaults?.['serve'].options?.port;
|
|
12
|
+
}
|
|
13
|
+
return (0, e2e_web_server_info_utils_1.getE2EWebServerInfo)(tree, projectName, {
|
|
14
|
+
plugin: '@nx/webpack/plugin',
|
|
15
|
+
serveTargetName: 'serveTargetName',
|
|
16
|
+
serveStaticTargetName: 'serveStaticTargetName',
|
|
17
|
+
configFilePath,
|
|
18
|
+
}, {
|
|
19
|
+
defaultServeTargetName: 'serve',
|
|
20
|
+
defaultServeStaticTargetName: 'serve-static',
|
|
21
|
+
defaultE2EWebServerAddress: `http://localhost:${e2ePort}`,
|
|
22
|
+
defaultE2ECiBaseUrl: 'http://localhost:4200',
|
|
23
|
+
defaultE2EPort: e2ePort,
|
|
24
|
+
}, isPluginBeingAdded);
|
|
25
|
+
}
|