@nx/webpack 18.2.0-beta.0 → 18.2.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/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "18.2.0-beta.
|
|
3
|
+
"version": "18.2.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.2.0-beta.
|
|
67
|
-
"@nx/js": "18.2.0-beta.
|
|
68
|
-
"@nrwl/webpack": "18.2.0-beta.
|
|
66
|
+
"@nx/devkit": "18.2.0-beta.2",
|
|
67
|
+
"@nx/js": "18.2.0-beta.2",
|
|
68
|
+
"@nrwl/webpack": "18.2.0-beta.2"
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
@@ -5,7 +5,7 @@ const path_1 = require("path");
|
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
function normalizeOptions(options) {
|
|
8
|
-
const
|
|
8
|
+
const combinedPluginAndMaybeExecutorOptions = {};
|
|
9
9
|
const isProd = process.env.NODE_ENV === 'production';
|
|
10
10
|
const projectName = process.env.NX_TASK_TARGET_PROJECT;
|
|
11
11
|
const targetName = process.env.NX_TASK_TARGET_TARGET;
|
|
@@ -14,6 +14,7 @@ function normalizeOptions(options) {
|
|
|
14
14
|
const projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
15
15
|
const projectNode = projectGraph.nodes[projectName];
|
|
16
16
|
const targetConfig = projectNode.data.targets[targetName];
|
|
17
|
+
normalizeRelativePaths(projectNode.data.root, options);
|
|
17
18
|
// Merge options from `@nx/webpack:webpack` into plugin options.
|
|
18
19
|
// Options from `@nx/webpack:webpack` take precedence.
|
|
19
20
|
const originalTargetOptions = targetConfig.options;
|
|
@@ -27,47 +28,49 @@ function normalizeOptions(options) {
|
|
|
27
28
|
if (configurationName) {
|
|
28
29
|
Object.assign(buildTargetOptions, targetConfig.configurations?.[configurationName]);
|
|
29
30
|
}
|
|
30
|
-
Object.assign(
|
|
31
|
+
Object.assign(combinedPluginAndMaybeExecutorOptions, buildTargetOptions, options // plugin options take precedence
|
|
32
|
+
);
|
|
31
33
|
}
|
|
32
34
|
else {
|
|
33
|
-
Object.assign(
|
|
35
|
+
Object.assign(combinedPluginAndMaybeExecutorOptions, originalTargetOptions, options // plugin options take precedence
|
|
36
|
+
);
|
|
34
37
|
}
|
|
35
|
-
normalizeRelativePaths(projectNode.data.root, options);
|
|
36
38
|
const sourceRoot = projectNode.data.sourceRoot ?? projectNode.data.root;
|
|
37
39
|
if (!options.main) {
|
|
38
40
|
throw new Error(`Missing "main" option for the entry file. Set this option in your Nx webpack plugin.`);
|
|
39
41
|
}
|
|
40
42
|
return {
|
|
41
|
-
...
|
|
42
|
-
assets:
|
|
43
|
-
? normalizeAssets(
|
|
43
|
+
...combinedPluginAndMaybeExecutorOptions,
|
|
44
|
+
assets: combinedPluginAndMaybeExecutorOptions.assets
|
|
45
|
+
? normalizeAssets(combinedPluginAndMaybeExecutorOptions.assets, devkit_1.workspaceRoot, sourceRoot, projectNode.data.root)
|
|
44
46
|
: [],
|
|
45
|
-
baseHref:
|
|
46
|
-
commonChunk:
|
|
47
|
-
compiler:
|
|
47
|
+
baseHref: combinedPluginAndMaybeExecutorOptions.baseHref ?? '/',
|
|
48
|
+
commonChunk: combinedPluginAndMaybeExecutorOptions.commonChunk ?? true,
|
|
49
|
+
compiler: combinedPluginAndMaybeExecutorOptions.compiler ?? 'babel',
|
|
48
50
|
configurationName,
|
|
49
|
-
deleteOutputPath:
|
|
50
|
-
extractCss:
|
|
51
|
-
fileReplacements: normalizeFileReplacements(devkit_1.workspaceRoot,
|
|
52
|
-
generateIndexHtml:
|
|
53
|
-
main:
|
|
54
|
-
namedChunks:
|
|
55
|
-
optimization:
|
|
56
|
-
outputFileName:
|
|
57
|
-
outputHashing:
|
|
58
|
-
|
|
51
|
+
deleteOutputPath: combinedPluginAndMaybeExecutorOptions.deleteOutputPath ?? true,
|
|
52
|
+
extractCss: combinedPluginAndMaybeExecutorOptions.extractCss ?? true,
|
|
53
|
+
fileReplacements: normalizeFileReplacements(devkit_1.workspaceRoot, combinedPluginAndMaybeExecutorOptions.fileReplacements),
|
|
54
|
+
generateIndexHtml: combinedPluginAndMaybeExecutorOptions.generateIndexHtml ?? true,
|
|
55
|
+
main: combinedPluginAndMaybeExecutorOptions.main,
|
|
56
|
+
namedChunks: combinedPluginAndMaybeExecutorOptions.namedChunks ?? !isProd,
|
|
57
|
+
optimization: combinedPluginAndMaybeExecutorOptions.optimization ?? isProd,
|
|
58
|
+
outputFileName: combinedPluginAndMaybeExecutorOptions.outputFileName ?? 'main.js',
|
|
59
|
+
outputHashing: combinedPluginAndMaybeExecutorOptions.outputHashing ??
|
|
60
|
+
(isProd ? 'all' : 'none'),
|
|
61
|
+
outputPath: combinedPluginAndMaybeExecutorOptions.outputPath,
|
|
59
62
|
projectGraph,
|
|
60
63
|
projectName,
|
|
61
64
|
projectRoot: projectNode.data.root,
|
|
62
65
|
root: devkit_1.workspaceRoot,
|
|
63
|
-
runtimeChunk:
|
|
64
|
-
scripts:
|
|
65
|
-
sourceMap:
|
|
66
|
+
runtimeChunk: combinedPluginAndMaybeExecutorOptions.runtimeChunk ?? true,
|
|
67
|
+
scripts: combinedPluginAndMaybeExecutorOptions.scripts ?? [],
|
|
68
|
+
sourceMap: combinedPluginAndMaybeExecutorOptions.sourceMap ?? !isProd,
|
|
66
69
|
sourceRoot,
|
|
67
|
-
styles:
|
|
68
|
-
target:
|
|
70
|
+
styles: combinedPluginAndMaybeExecutorOptions.styles ?? [],
|
|
71
|
+
target: combinedPluginAndMaybeExecutorOptions.target,
|
|
69
72
|
targetName,
|
|
70
|
-
vendorChunk:
|
|
73
|
+
vendorChunk: combinedPluginAndMaybeExecutorOptions.vendorChunk ?? !isProd,
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
76
|
exports.normalizeOptions = normalizeOptions;
|
package/src/plugins/plugin.js
CHANGED