@nx/webpack 0.0.0-pr-30457-0ed97e4 → 0.0.0-pr-30516-4c8bfff
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/migrations.json +0 -13
- package/package.json +5 -5
- package/src/generators/convert-to-inferred/utils/serve-post-target-transformer.js +1 -4
- package/src/plugins/nx-webpack-plugin/lib/apply-base-config.js +3 -39
- package/src/plugins/nx-webpack-plugin/lib/apply-web-config.js +1 -1
- package/src/plugins/nx-webpack-plugin/lib/compiler-loaders.d.ts +0 -2
- package/src/plugins/nx-webpack-plugin/lib/compiler-loaders.js +0 -2
- package/src/plugins/nx-webpack-plugin/lib/stylesheet-loaders.js +1 -1
- package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts +1 -2
- package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin.js +0 -4
- package/src/plugins/nx-webpack-plugin/lib/utils.d.ts +0 -7
- package/src/plugins/nx-webpack-plugin/lib/utils.js +0 -48
package/migrations.json
CHANGED
|
@@ -44,19 +44,6 @@
|
|
|
44
44
|
"alwaysAddToPackageJson": false
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
},
|
|
48
|
-
"20.7.1": {
|
|
49
|
-
"version": "20.7.1-beta.0",
|
|
50
|
-
"packages": {
|
|
51
|
-
"webpack": {
|
|
52
|
-
"version": "^5.98.0",
|
|
53
|
-
"alwaysAddToPackageJson": false
|
|
54
|
-
},
|
|
55
|
-
"webpack-dev-server": {
|
|
56
|
-
"version": "^5.2.1",
|
|
57
|
-
"alwaysAddToPackageJson": false
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
47
|
}
|
|
61
48
|
}
|
|
62
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-30516-4c8bfff",
|
|
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": {
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"ts-loader": "^9.3.1",
|
|
63
63
|
"tsconfig-paths-webpack-plugin": "4.0.0",
|
|
64
64
|
"tslib": "^2.3.0",
|
|
65
|
-
"webpack": "^5.
|
|
66
|
-
"webpack-dev-server": "^5.
|
|
65
|
+
"webpack": "^5.80.0",
|
|
66
|
+
"webpack-dev-server": "^5.0.4",
|
|
67
67
|
"webpack-node-externals": "^3.0.0",
|
|
68
68
|
"webpack-subresource-integrity": "^5.1.0",
|
|
69
|
-
"@nx/devkit": "0.0.0-pr-
|
|
70
|
-
"@nx/js": "0.0.0-pr-
|
|
69
|
+
"@nx/devkit": "0.0.0-pr-30516-4c8bfff",
|
|
70
|
+
"@nx/js": "0.0.0-pr-30516-4c8bfff"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
@@ -156,10 +156,7 @@ function extractDevServerOptions(options, context) {
|
|
|
156
156
|
return devServerOptions;
|
|
157
157
|
}
|
|
158
158
|
function applyDefaults(options, buildOptions) {
|
|
159
|
-
if (
|
|
160
|
-
options = {};
|
|
161
|
-
}
|
|
162
|
-
if (options?.port === undefined) {
|
|
159
|
+
if (options.port === undefined) {
|
|
163
160
|
options.port = 4200;
|
|
164
161
|
}
|
|
165
162
|
options.headers = { 'Access-Control-Allow-Origin': '*' };
|
|
@@ -15,15 +15,10 @@ const compiler_loaders_1 = require("./compiler-loaders");
|
|
|
15
15
|
const TerserPlugin = require("terser-webpack-plugin");
|
|
16
16
|
const nodeExternals = require("webpack-node-externals");
|
|
17
17
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
18
|
-
const utils_1 = require("./utils");
|
|
19
18
|
const IGNORED_WEBPACK_WARNINGS = [
|
|
20
19
|
/The comment file/i,
|
|
21
20
|
/could not find any license/i,
|
|
22
21
|
];
|
|
23
|
-
const extensionAlias = {
|
|
24
|
-
'.js': ['.ts', '.js'],
|
|
25
|
-
'.mjs': ['.mts', '.mjs'],
|
|
26
|
-
};
|
|
27
22
|
const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
|
|
28
23
|
const mainFields = ['module', 'main'];
|
|
29
24
|
function applyBaseConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
@@ -188,11 +183,8 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
|
188
183
|
if (options.useTsconfigPaths) {
|
|
189
184
|
plugins.push(new nx_tsconfig_paths_webpack_plugin_1.NxTsconfigPathsWebpackPlugin({ ...options, tsConfig }));
|
|
190
185
|
}
|
|
191
|
-
// New TS Solution already has a typecheck target
|
|
192
|
-
if (
|
|
193
|
-
(isUsingTsSolution &&
|
|
194
|
-
options?.skipTypeChecking === false &&
|
|
195
|
-
process.env['WEBPACK_SERVE'])) {
|
|
186
|
+
// New TS Solution already has a typecheck target
|
|
187
|
+
if (!options?.skipTypeChecking && !isUsingTsSolution) {
|
|
196
188
|
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
197
189
|
plugins.push(new ForkTsCheckerWebpackPlugin({
|
|
198
190
|
typescript: {
|
|
@@ -279,31 +271,7 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
|
279
271
|
const externals = [];
|
|
280
272
|
if (options.target === 'node' && options.externalDependencies === 'all') {
|
|
281
273
|
const modulesDir = `${options.root}/node_modules`;
|
|
282
|
-
|
|
283
|
-
const projectName = options.projectName;
|
|
284
|
-
const deps = graph?.dependencies?.[projectName] ?? [];
|
|
285
|
-
// Collect non-buildable TS project references so that they are bundled
|
|
286
|
-
// in the final output. This is needed for projects that are not buildable
|
|
287
|
-
// but are referenced by buildable projects. This is needed for the new TS
|
|
288
|
-
// solution setup.
|
|
289
|
-
const nonBuildableWorkspaceLibs = isUsingTsSolution
|
|
290
|
-
? deps
|
|
291
|
-
.filter((dep) => {
|
|
292
|
-
const node = graph.nodes?.[dep.target];
|
|
293
|
-
if (!node || node.type !== 'lib')
|
|
294
|
-
return false;
|
|
295
|
-
const hasBuildTarget = 'build' in (node.data?.targets ?? {});
|
|
296
|
-
if (hasBuildTarget) {
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
|
-
// If there is no build target we check the package exports to see if they reference
|
|
300
|
-
// source files
|
|
301
|
-
return !(0, utils_1.isBuildableLibrary)(node);
|
|
302
|
-
})
|
|
303
|
-
.map((dep) => graph.nodes?.[dep.target]?.data?.metadata?.js?.packageName)
|
|
304
|
-
.filter((name) => !!name)
|
|
305
|
-
: [];
|
|
306
|
-
externals.push(nodeExternals({ modulesDir, allowlist: nonBuildableWorkspaceLibs }));
|
|
274
|
+
externals.push(nodeExternals({ modulesDir }));
|
|
307
275
|
}
|
|
308
276
|
else if (Array.isArray(options.externalDependencies)) {
|
|
309
277
|
externals.push(function (ctx, callback) {
|
|
@@ -318,10 +286,6 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
|
318
286
|
config.resolve = {
|
|
319
287
|
...config.resolve,
|
|
320
288
|
extensions: [...(config?.resolve?.extensions ?? []), ...extensions],
|
|
321
|
-
extensionAlias: {
|
|
322
|
-
...(config.resolve?.extensionAlias ?? {}),
|
|
323
|
-
...extensionAlias,
|
|
324
|
-
},
|
|
325
289
|
alias: {
|
|
326
290
|
...(config.resolve?.alias ?? {}),
|
|
327
291
|
...(options.fileReplacements?.reduce((aliases, replacement) => ({
|
|
@@ -34,7 +34,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
34
34
|
sri: options.subresourceIntegrity,
|
|
35
35
|
outputPath: path.basename(options.index),
|
|
36
36
|
indexPath: path.join(options.root, options.index),
|
|
37
|
-
baseHref: options.baseHref
|
|
37
|
+
baseHref: options.baseHref,
|
|
38
38
|
deployUrl: options.deployUrl,
|
|
39
39
|
scripts: options.scripts,
|
|
40
40
|
styles: options.styles,
|
|
@@ -98,7 +98,7 @@ function postcssOptionsCreator(options, { includePaths, forCssModules = false, }
|
|
|
98
98
|
? []
|
|
99
99
|
: [
|
|
100
100
|
(0, postcss_cli_resources_1.PostcssCliResources)({
|
|
101
|
-
baseHref: options.baseHref
|
|
101
|
+
baseHref: options.baseHref,
|
|
102
102
|
deployUrl: options.deployUrl,
|
|
103
103
|
loader,
|
|
104
104
|
filename: `[name]${hashFormat.file}.[ext]`,
|
|
@@ -57,7 +57,7 @@ export interface NxAppWebpackPluginOptions {
|
|
|
57
57
|
/**
|
|
58
58
|
* Set <base href> for the resulting index.html.
|
|
59
59
|
*/
|
|
60
|
-
baseHref?: string
|
|
60
|
+
baseHref?: string;
|
|
61
61
|
/**
|
|
62
62
|
* Build the libraries from source. Default is `true`.
|
|
63
63
|
*/
|
|
@@ -73,7 +73,6 @@ export interface NxAppWebpackPluginOptions {
|
|
|
73
73
|
crossOrigin?: 'none' | 'anonymous' | 'use-credentials';
|
|
74
74
|
/**
|
|
75
75
|
* Delete the output path before building.
|
|
76
|
-
* @deprecated Use the `output.clean` option in Webpack. https://webpack.js.org/guides/output-management/#cleaning-up-the-dist-folder
|
|
77
76
|
*/
|
|
78
77
|
deleteOutputPath?: boolean;
|
|
79
78
|
/**
|
|
@@ -29,10 +29,6 @@ class NxAppWebpackPlugin {
|
|
|
29
29
|
if (typeof target === 'string') {
|
|
30
30
|
this.options.target = target;
|
|
31
31
|
}
|
|
32
|
-
// Prefer `clean` option from Webpack config over our own.
|
|
33
|
-
if (typeof compiler.options.output?.clean !== 'undefined') {
|
|
34
|
-
this.options.deleteOutputPath = false;
|
|
35
|
-
}
|
|
36
32
|
(0, apply_base_config_1.applyBaseConfig)(this.options, compiler.options, {
|
|
37
33
|
useNormalizedEntry: true,
|
|
38
34
|
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isBuildableLibrary = isBuildableLibrary;
|
|
4
|
-
function isSourceFile(path) {
|
|
5
|
-
return ['.ts', '.tsx', '.mts', '.cts'].some((ext) => path.endsWith(ext));
|
|
6
|
-
}
|
|
7
|
-
function isBuildableExportMap(packageExports) {
|
|
8
|
-
if (!packageExports || Object.keys(packageExports).length === 0) {
|
|
9
|
-
return false; // exports = {} → not buildable
|
|
10
|
-
}
|
|
11
|
-
const isCompiledExport = (value) => {
|
|
12
|
-
if (typeof value === 'string') {
|
|
13
|
-
return !isSourceFile(value);
|
|
14
|
-
}
|
|
15
|
-
if (typeof value === 'object' && value !== null) {
|
|
16
|
-
return Object.entries(value).some(([key, subValue]) => {
|
|
17
|
-
if (key === 'types' ||
|
|
18
|
-
key === 'development' ||
|
|
19
|
-
key === './package.json')
|
|
20
|
-
return false;
|
|
21
|
-
return typeof subValue === 'string' && !isSourceFile(subValue);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return false;
|
|
25
|
-
};
|
|
26
|
-
if (packageExports['.']) {
|
|
27
|
-
return isCompiledExport(packageExports['.']);
|
|
28
|
-
}
|
|
29
|
-
return Object.entries(packageExports).some(([key, value]) => key !== '.' && isCompiledExport(value));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Check if the library is buildable.
|
|
33
|
-
* @param node from the project graph
|
|
34
|
-
* @returns boolean
|
|
35
|
-
*/
|
|
36
|
-
function isBuildableLibrary(node) {
|
|
37
|
-
if (!node.data.metadata?.js) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
const { packageExports, packageMain } = node.data.metadata.js;
|
|
41
|
-
// if we have exports only check this else fallback to packageMain
|
|
42
|
-
if (packageExports) {
|
|
43
|
-
return isBuildableExportMap(packageExports);
|
|
44
|
-
}
|
|
45
|
-
return (typeof packageMain === 'string' &&
|
|
46
|
-
packageMain !== '' &&
|
|
47
|
-
!isSourceFile(packageMain));
|
|
48
|
-
}
|