@nx/webpack 18.3.0-beta.1 → 18.3.0-beta.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/package.json +4 -4
- package/src/generators/init/init.js +24 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "18.3.0-beta.
|
|
3
|
+
"version": "18.3.0-beta.2",
|
|
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": {
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"webpack-dev-server": "^4.9.3",
|
|
64
64
|
"webpack-node-externals": "^3.0.0",
|
|
65
65
|
"webpack-subresource-integrity": "^5.1.0",
|
|
66
|
-
"@nx/devkit": "18.3.0-beta.
|
|
67
|
-
"@nx/js": "18.3.0-beta.
|
|
68
|
-
"@nrwl/webpack": "18.3.0-beta.
|
|
66
|
+
"@nx/devkit": "18.3.0-beta.2",
|
|
67
|
+
"@nx/js": "18.3.0-beta.2",
|
|
68
|
+
"@nrwl/webpack": "18.3.0-beta.2"
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.webpackInitGeneratorInternal = exports.webpackInitGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
6
6
|
const plugin_1 = require("../../plugins/plugin");
|
|
7
7
|
const versions_1 = require("../../utils/versions");
|
|
8
8
|
function webpackInitGenerator(tree, schema) {
|
|
@@ -15,7 +15,29 @@ async function webpackInitGeneratorInternal(tree, schema) {
|
|
|
15
15
|
nxJson.useInferencePlugins !== false;
|
|
16
16
|
schema.addPlugin ??= addPluginDefault;
|
|
17
17
|
if (schema.addPlugin) {
|
|
18
|
-
addPlugin(tree)
|
|
18
|
+
await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/webpack/plugin', plugin_1.createNodes, {
|
|
19
|
+
buildTargetName: [
|
|
20
|
+
'build',
|
|
21
|
+
'webpack:build',
|
|
22
|
+
'build:webpack',
|
|
23
|
+
'webpack-build',
|
|
24
|
+
'build-webpack',
|
|
25
|
+
],
|
|
26
|
+
serveTargetName: [
|
|
27
|
+
'serve',
|
|
28
|
+
'webpack:serve',
|
|
29
|
+
'serve:webpack',
|
|
30
|
+
'webpack-serve',
|
|
31
|
+
'serve-webpack',
|
|
32
|
+
],
|
|
33
|
+
previewTargetName: [
|
|
34
|
+
'preview',
|
|
35
|
+
'webpack:preview',
|
|
36
|
+
'preview:webpack',
|
|
37
|
+
'webpack-preview',
|
|
38
|
+
'preview-webpack',
|
|
39
|
+
],
|
|
40
|
+
}, schema.updatePackageScripts);
|
|
19
41
|
}
|
|
20
42
|
let installTask = () => { };
|
|
21
43
|
if (!schema.skipPackageJson) {
|
|
@@ -28,33 +50,10 @@ async function webpackInitGeneratorInternal(tree, schema) {
|
|
|
28
50
|
}
|
|
29
51
|
installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, schema.keepExistingVersions);
|
|
30
52
|
}
|
|
31
|
-
if (schema.updatePackageScripts) {
|
|
32
|
-
await (0, update_package_scripts_1.updatePackageScripts)(tree, plugin_1.createNodes);
|
|
33
|
-
}
|
|
34
53
|
if (!schema.skipFormat) {
|
|
35
54
|
await (0, devkit_1.formatFiles)(tree);
|
|
36
55
|
}
|
|
37
56
|
return installTask;
|
|
38
57
|
}
|
|
39
58
|
exports.webpackInitGeneratorInternal = webpackInitGeneratorInternal;
|
|
40
|
-
function addPlugin(tree) {
|
|
41
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
42
|
-
nxJson.plugins ??= [];
|
|
43
|
-
for (const plugin of nxJson.plugins) {
|
|
44
|
-
if (typeof plugin === 'string'
|
|
45
|
-
? plugin === '@nx/webpack/plugin'
|
|
46
|
-
: plugin.plugin === '@nx/webpack/plugin') {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
nxJson.plugins.push({
|
|
51
|
-
plugin: '@nx/webpack/plugin',
|
|
52
|
-
options: {
|
|
53
|
-
buildTargetName: 'build',
|
|
54
|
-
serveTargetName: 'serve',
|
|
55
|
-
previewTargetName: 'preview',
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
59
|
-
}
|
|
60
59
|
exports.default = webpackInitGenerator;
|