@nx/webpack 19.5.7 → 19.6.0-beta.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.6.0-beta.1",
|
|
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": "^4.9.3",
|
|
70
70
|
"webpack-node-externals": "^3.0.0",
|
|
71
71
|
"webpack-subresource-integrity": "^5.1.0",
|
|
72
|
-
"@nx/devkit": "19.
|
|
73
|
-
"@nx/js": "19.
|
|
74
|
-
"@nrwl/webpack": "19.
|
|
72
|
+
"@nx/devkit": "19.6.0-beta.1",
|
|
73
|
+
"@nx/js": "19.6.0-beta.1",
|
|
74
|
+
"@nrwl/webpack": "19.6.0-beta.1"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
@@ -5,7 +5,7 @@ exports.configurationGeneratorInternal = configurationGeneratorInternal;
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const init_1 = require("../init/init");
|
|
7
7
|
const has_plugin_1 = require("../../utils/has-plugin");
|
|
8
|
-
const
|
|
8
|
+
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
9
9
|
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
10
10
|
function configurationGenerator(tree, options) {
|
|
11
11
|
return configurationGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
@@ -125,7 +125,7 @@ module.exports = composePlugins(withNx(), (config) => {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
function addBuildTarget(tree, options) {
|
|
128
|
-
(0,
|
|
128
|
+
(0, target_defaults_utils_1.addBuildTargetDefaults)(tree, '@nx/webpack:webpack');
|
|
129
129
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
130
130
|
const buildOptions = {
|
|
131
131
|
target: options.target,
|
package/src/plugins/plugin.js
CHANGED
|
@@ -150,6 +150,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
|
|
|
150
150
|
},
|
|
151
151
|
};
|
|
152
152
|
targets[options.serveStaticTargetName] = {
|
|
153
|
+
dependsOn: [options.buildTargetName],
|
|
153
154
|
executor: '@nx/web:file-server',
|
|
154
155
|
options: {
|
|
155
156
|
buildTarget: options.buildTargetName,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NxWebpackExecutionContext } from '../../utils/config';
|
|
2
|
-
import { NxAppWebpackPluginOptions } from '../nx-webpack-plugin/nx-app-webpack-plugin-options';
|
|
3
|
-
import { Configuration } from 'webpack';
|
|
1
|
+
import type { NxWebpackExecutionContext } from '../../utils/config';
|
|
2
|
+
import type { NxAppWebpackPluginOptions } from '../nx-webpack-plugin/nx-app-webpack-plugin-options';
|
|
3
|
+
import type { Compiler, Configuration } from 'webpack';
|
|
4
4
|
/**
|
|
5
5
|
* This function is used to wrap the legacy plugin function to be used with the `composePlugins` function.
|
|
6
6
|
* Initially the webpack config would be passed to the legacy plugin function and the options would be passed as a second argument.
|
|
@@ -26,4 +26,6 @@ module.exports = async () => ({
|
|
|
26
26
|
* @param executorOptions The options passed usually inside the executor or the config file
|
|
27
27
|
* @returns Webpack configuration
|
|
28
28
|
*/
|
|
29
|
-
export declare function useLegacyNxPlugin(fn: (config: Configuration, ctx: NxWebpackExecutionContext) => Promise<Configuration>, executorOptions: NxAppWebpackPluginOptions): Promise<
|
|
29
|
+
export declare function useLegacyNxPlugin(fn: (config: Configuration, ctx: NxWebpackExecutionContext) => Promise<Configuration>, executorOptions: NxAppWebpackPluginOptions): Promise<{
|
|
30
|
+
apply(compiler: Compiler): void;
|
|
31
|
+
}>;
|
|
@@ -47,12 +47,24 @@ async function useLegacyNxPlugin(fn, executorOptions) {
|
|
|
47
47
|
projectName: projectName,
|
|
48
48
|
};
|
|
49
49
|
const configuration = process.env.NX_TASK_TARGET_CONFIGURATION;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
const ctx = {
|
|
51
|
+
context,
|
|
52
|
+
options: options,
|
|
53
|
+
configuration,
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
apply(compiler) {
|
|
57
|
+
compiler.hooks.beforeCompile.tapPromise('NxLegacyAsyncPlugin', () => {
|
|
58
|
+
return new Promise((resolve) => {
|
|
59
|
+
fn(compiler.options, ctx).then((updated) => {
|
|
60
|
+
// Merge options back shallowly since it's a fully functional configuration.
|
|
61
|
+
// Most likely, the user modified the config in place, but this guarantees that updates are applied if users did something like:
|
|
62
|
+
// `return { ...config, plugins: [...config.plugins, new MyPlugin()] }`
|
|
63
|
+
Object.assign(compiler.options, updated);
|
|
64
|
+
resolve();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
},
|
|
57
69
|
};
|
|
58
70
|
}
|