@nx/webpack 19.0.0-beta.6 → 19.0.0-beta.7
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/app-plugin.d.ts +2 -0
- package/app-plugin.js +5 -0
- package/index.d.ts +6 -2
- package/index.js +8 -5
- package/package.json +4 -4
- package/src/generators/configuration/configuration.js +4 -4
- package/src/plugins/nx-webpack-plugin/lib/apply-base-config.d.ts +2 -2
- package/src/plugins/nx-webpack-plugin/lib/apply-web-config.d.ts +2 -2
- package/src/plugins/nx-webpack-plugin/lib/compiler-loaders.d.ts +2 -2
- package/src/plugins/nx-webpack-plugin/lib/instantiate-script-plugins.d.ts +2 -2
- package/src/plugins/nx-webpack-plugin/lib/normalize-options.d.ts +2 -2
- package/src/plugins/nx-webpack-plugin/lib/normalize-options.js +12 -3
- package/src/plugins/nx-webpack-plugin/lib/stylesheet-loaders.d.ts +4 -4
- package/src/plugins/nx-webpack-plugin/{nx-webpack-plugin-options.d.ts → nx-app-webpack-plugin-options.d.ts} +2 -2
- package/src/plugins/nx-webpack-plugin/{nx-webpack-plugin.d.ts → nx-app-webpack-plugin.d.ts} +3 -3
- package/src/plugins/nx-webpack-plugin/{nx-webpack-plugin.js → nx-app-webpack-plugin.js} +3 -3
- package/src/utils/with-nx.d.ts +2 -2
- package/tsconfig-paths-plugin.d.ts +1 -0
- package/tsconfig-paths-plugin.js +5 -0
- /package/src/plugins/nx-webpack-plugin/{nx-webpack-plugin-options.js → nx-app-webpack-plugin-options.js} +0 -0
package/app-plugin.d.ts
ADDED
package/app-plugin.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NxAppWebpackPlugin = void 0;
|
|
4
|
+
var nx_app_webpack_plugin_1 = require("./src/plugins/nx-webpack-plugin/nx-app-webpack-plugin");
|
|
5
|
+
Object.defineProperty(exports, "NxAppWebpackPlugin", { enumerable: true, get: function () { return nx_app_webpack_plugin_1.NxAppWebpackPlugin; } });
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { configurationGenerator } from './src/generators/configuration/configuration';
|
|
2
|
+
import { NxAppWebpackPlugin } from './src/plugins/nx-webpack-plugin/nx-app-webpack-plugin';
|
|
3
|
+
import { NxTsconfigPathsWebpackPlugin as _NxTsconfigPathsWebpackPlugin } from './src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin';
|
|
2
4
|
export { configurationGenerator };
|
|
3
5
|
/** @deprecated Use `configurationGenerator` instead. */
|
|
4
6
|
export declare const webpackProjectGenerator: typeof configurationGenerator;
|
|
7
|
+
/** @deprecated Use NxAppWebpackPlugin from `@nx/webpack/app-plugin` instead. */
|
|
8
|
+
export declare const NxWebpackPlugin: typeof NxAppWebpackPlugin;
|
|
9
|
+
/** @deprecated Use NxTsconfigPathsWebpackPlugin from `@nx/webpack/tsconfig-paths-plugin` instead. */
|
|
10
|
+
export declare const NxTsconfigPathsWebpackPlugin: typeof _NxTsconfigPathsWebpackPlugin;
|
|
5
11
|
export * from './src/utils/create-copy-plugin';
|
|
6
12
|
export * from './src/utils/config';
|
|
7
13
|
export { webpackInitGenerator } from './src/generators/init/init';
|
|
@@ -14,5 +20,3 @@ export * from './src/utils/get-css-module-local-ident';
|
|
|
14
20
|
export * from './src/utils/with-nx';
|
|
15
21
|
export * from './src/utils/with-web';
|
|
16
22
|
export * from './src/utils/module-federation/public-api';
|
|
17
|
-
export { NxWebpackPlugin } from './src/plugins/nx-webpack-plugin/nx-webpack-plugin';
|
|
18
|
-
export { NxTsconfigPathsWebpackPlugin } from './src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin';
|
package/index.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.webpackInitGenerator = exports.NxTsconfigPathsWebpackPlugin = exports.NxWebpackPlugin = exports.webpackProjectGenerator = exports.configurationGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const configuration_1 = require("./src/generators/configuration/configuration");
|
|
6
6
|
Object.defineProperty(exports, "configurationGenerator", { enumerable: true, get: function () { return configuration_1.configurationGenerator; } });
|
|
7
|
+
const nx_app_webpack_plugin_1 = require("./src/plugins/nx-webpack-plugin/nx-app-webpack-plugin");
|
|
8
|
+
const nx_tsconfig_paths_webpack_plugin_1 = require("./src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin");
|
|
7
9
|
// Exported for backwards compatibility in case a plugin is using the old name.
|
|
8
10
|
/** @deprecated Use `configurationGenerator` instead. */
|
|
9
11
|
exports.webpackProjectGenerator = configuration_1.configurationGenerator;
|
|
12
|
+
// TODO(v20): Remove this in favor of deep imports in order to load configs faster (150-200ms faster).
|
|
13
|
+
/** @deprecated Use NxAppWebpackPlugin from `@nx/webpack/app-plugin` instead. */
|
|
14
|
+
exports.NxWebpackPlugin = nx_app_webpack_plugin_1.NxAppWebpackPlugin;
|
|
15
|
+
/** @deprecated Use NxTsconfigPathsWebpackPlugin from `@nx/webpack/tsconfig-paths-plugin` instead. */
|
|
16
|
+
exports.NxTsconfigPathsWebpackPlugin = nx_tsconfig_paths_webpack_plugin_1.NxTsconfigPathsWebpackPlugin;
|
|
10
17
|
tslib_1.__exportStar(require("./src/utils/create-copy-plugin"), exports);
|
|
11
18
|
tslib_1.__exportStar(require("./src/utils/config"), exports);
|
|
12
19
|
var init_1 = require("./src/generators/init/init");
|
|
@@ -18,7 +25,3 @@ tslib_1.__exportStar(require("./src/utils/get-css-module-local-ident"), exports)
|
|
|
18
25
|
tslib_1.__exportStar(require("./src/utils/with-nx"), exports);
|
|
19
26
|
tslib_1.__exportStar(require("./src/utils/with-web"), exports);
|
|
20
27
|
tslib_1.__exportStar(require("./src/utils/module-federation/public-api"), exports);
|
|
21
|
-
var nx_webpack_plugin_1 = require("./src/plugins/nx-webpack-plugin/nx-webpack-plugin");
|
|
22
|
-
Object.defineProperty(exports, "NxWebpackPlugin", { enumerable: true, get: function () { return nx_webpack_plugin_1.NxWebpackPlugin; } });
|
|
23
|
-
var nx_tsconfig_paths_webpack_plugin_1 = require("./src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin");
|
|
24
|
-
Object.defineProperty(exports, "NxTsconfigPathsWebpackPlugin", { enumerable: true, get: function () { return nx_tsconfig_paths_webpack_plugin_1.NxTsconfigPathsWebpackPlugin; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "19.0.0-beta.
|
|
3
|
+
"version": "19.0.0-beta.7",
|
|
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": "19.0.0-beta.
|
|
67
|
-
"@nx/js": "19.0.0-beta.
|
|
68
|
-
"@nrwl/webpack": "19.0.0-beta.
|
|
66
|
+
"@nx/devkit": "19.0.0-beta.7",
|
|
67
|
+
"@nx/js": "19.0.0-beta.7",
|
|
68
|
+
"@nrwl/webpack": "19.0.0-beta.7"
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
@@ -63,7 +63,7 @@ function createWebpackConfig(tree, options) {
|
|
|
63
63
|
if (options.target === 'web') {
|
|
64
64
|
tree.write((0, devkit_1.joinPathFragments)(project.root, 'webpack.config.js'), (0, has_plugin_1.hasPlugin)(tree)
|
|
65
65
|
? `
|
|
66
|
-
const {
|
|
66
|
+
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
|
|
67
67
|
const { join } = require('path');
|
|
68
68
|
|
|
69
69
|
module.exports = {
|
|
@@ -71,7 +71,7 @@ module.exports = {
|
|
|
71
71
|
path: join(__dirname, '${(0, devkit_1.offsetFromRoot)(project.root)}${buildOptions.outputPath}'),
|
|
72
72
|
},
|
|
73
73
|
plugins: [
|
|
74
|
-
new
|
|
74
|
+
new NxAppWebpackPlugin({
|
|
75
75
|
target: '${buildOptions.target}',
|
|
76
76
|
tsConfig: '${buildOptions.tsConfig}',
|
|
77
77
|
compiler: '${buildOptions.compiler}',
|
|
@@ -95,7 +95,7 @@ module.exports = composePlugins(withNx(), withWeb(), (config) => {
|
|
|
95
95
|
else {
|
|
96
96
|
tree.write((0, devkit_1.joinPathFragments)(project.root, 'webpack.config.js'), (0, has_plugin_1.hasPlugin)(tree)
|
|
97
97
|
? `
|
|
98
|
-
const {
|
|
98
|
+
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
|
|
99
99
|
const { join } = require('path');
|
|
100
100
|
|
|
101
101
|
module.exports = {
|
|
@@ -103,7 +103,7 @@ module.exports = {
|
|
|
103
103
|
path: join(__dirname, '${(0, devkit_1.offsetFromRoot)(project.root)}${buildOptions.outputPath}'),
|
|
104
104
|
},
|
|
105
105
|
plugins: [
|
|
106
|
-
new
|
|
106
|
+
new NxAppWebpackPlugin({
|
|
107
107
|
target: '${buildOptions.target}',
|
|
108
108
|
tsConfig: '${buildOptions.tsConfig}',
|
|
109
109
|
compiler: '${buildOptions.compiler}',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
2
|
-
import {
|
|
3
|
-
export declare function applyBaseConfig(options:
|
|
2
|
+
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
3
|
+
export declare function applyBaseConfig(options: NormalizedNxAppWebpackPluginOptions, config?: Partial<WebpackOptionsNormalized | Configuration>, { useNormalizedEntry, }?: {
|
|
4
4
|
useNormalizedEntry?: boolean;
|
|
5
5
|
}): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
2
|
-
import {
|
|
3
|
-
export declare function applyWebConfig(options:
|
|
2
|
+
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
3
|
+
export declare function applyWebConfig(options: NormalizedNxAppWebpackPluginOptions, config?: Partial<WebpackOptionsNormalized | Configuration>, { useNormalizedEntry, }?: {
|
|
4
4
|
useNormalizedEntry?: boolean;
|
|
5
5
|
}): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function createLoaderFromCompiler(options:
|
|
1
|
+
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
2
|
+
export declare function createLoaderFromCompiler(options: NormalizedNxAppWebpackPluginOptions): {
|
|
3
3
|
test: RegExp;
|
|
4
4
|
loader: string;
|
|
5
5
|
exclude: RegExp;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { WebpackPluginInstance } from 'webpack';
|
|
2
|
-
import {
|
|
3
|
-
export declare function instantiateScriptPlugins(options:
|
|
2
|
+
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
3
|
+
export declare function instantiateScriptPlugins(options: NormalizedNxAppWebpackPluginOptions): WebpackPluginInstance[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetGlobPattern, FileReplacement,
|
|
2
|
-
export declare function normalizeOptions(options:
|
|
1
|
+
import { AssetGlobPattern, FileReplacement, NormalizedNxAppWebpackPluginOptions, NxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
2
|
+
export declare function normalizeOptions(options: NxAppWebpackPluginOptions): NormalizedNxAppWebpackPluginOptions;
|
|
3
3
|
export declare function normalizeAssets(assets: any[], root: string, sourceRoot: string, projectRoot: string, resolveRelativePathsToProjectRoot?: boolean): AssetGlobPattern[];
|
|
4
4
|
export declare function normalizeFileReplacements(root: string, fileReplacements: FileReplacement[]): FileReplacement[];
|
|
@@ -7,11 +7,20 @@ const devkit_1 = require("@nx/devkit");
|
|
|
7
7
|
function normalizeOptions(options) {
|
|
8
8
|
const combinedPluginAndMaybeExecutorOptions = {};
|
|
9
9
|
const isProd = process.env.NODE_ENV === 'production';
|
|
10
|
-
const projectName = process.env.NX_TASK_TARGET_PROJECT;
|
|
11
|
-
const targetName = process.env.NX_TASK_TARGET_TARGET;
|
|
12
|
-
const configurationName = process.env.NX_TASK_TARGET_CONFIGURATION;
|
|
13
10
|
// Since this is invoked by the executor, the graph has already been created and cached.
|
|
14
11
|
const projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
12
|
+
const taskDetailsFromBuildTarget = process.env.NX_BUILD_TARGET
|
|
13
|
+
? (0, devkit_1.parseTargetString)(process.env.NX_BUILD_TARGET, projectGraph)
|
|
14
|
+
: undefined;
|
|
15
|
+
const projectName = taskDetailsFromBuildTarget
|
|
16
|
+
? taskDetailsFromBuildTarget.project
|
|
17
|
+
: process.env.NX_TASK_TARGET_PROJECT;
|
|
18
|
+
const targetName = taskDetailsFromBuildTarget
|
|
19
|
+
? taskDetailsFromBuildTarget.target
|
|
20
|
+
: process.env.NX_TASK_TARGET_TARGET;
|
|
21
|
+
const configurationName = taskDetailsFromBuildTarget
|
|
22
|
+
? taskDetailsFromBuildTarget.configuration
|
|
23
|
+
: process.env.NX_TASK_TARGET_CONFIGURATION;
|
|
15
24
|
const projectNode = projectGraph.nodes[projectName];
|
|
16
25
|
const targetConfig = projectNode.data.targets[targetName];
|
|
17
26
|
normalizeRelativePaths(projectNode.data.root, options);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getCSSModuleLocalIdent } from '../../../utils/get-css-module-local-ident';
|
|
2
|
-
import {
|
|
2
|
+
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
3
3
|
interface PostcssOptions {
|
|
4
4
|
(loader: any): any;
|
|
5
5
|
config?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function getCommonLoadersForCssModules(options:
|
|
7
|
+
export declare function getCommonLoadersForCssModules(options: NormalizedNxAppWebpackPluginOptions, includePaths: string[]): ({
|
|
8
8
|
loader: any;
|
|
9
9
|
options?: undefined;
|
|
10
10
|
} | {
|
|
@@ -27,7 +27,7 @@ export declare function getCommonLoadersForCssModules(options: NormalizedNxWebpa
|
|
|
27
27
|
importLoaders?: undefined;
|
|
28
28
|
};
|
|
29
29
|
})[];
|
|
30
|
-
export declare function getCommonLoadersForGlobalCss(options:
|
|
30
|
+
export declare function getCommonLoadersForGlobalCss(options: NormalizedNxAppWebpackPluginOptions, includePaths: string[]): ({
|
|
31
31
|
loader: any;
|
|
32
32
|
options?: undefined;
|
|
33
33
|
} | {
|
|
@@ -45,7 +45,7 @@ export declare function getCommonLoadersForGlobalCss(options: NormalizedNxWebpac
|
|
|
45
45
|
url?: undefined;
|
|
46
46
|
};
|
|
47
47
|
})[];
|
|
48
|
-
export declare function getCommonLoadersForGlobalStyle(options:
|
|
48
|
+
export declare function getCommonLoadersForGlobalStyle(options: NormalizedNxAppWebpackPluginOptions, includePaths: string[]): ({
|
|
49
49
|
loader: any;
|
|
50
50
|
options: {
|
|
51
51
|
esModule: boolean;
|
|
@@ -29,7 +29,7 @@ export interface OptimizationOptions {
|
|
|
29
29
|
scripts: boolean;
|
|
30
30
|
styles: boolean;
|
|
31
31
|
}
|
|
32
|
-
export interface
|
|
32
|
+
export interface NxAppWebpackPluginOptions {
|
|
33
33
|
/**
|
|
34
34
|
* The tsconfig file for the project. e.g. `tsconfig.json`
|
|
35
35
|
*/
|
|
@@ -203,7 +203,7 @@ export interface NxWebpackPluginOptions {
|
|
|
203
203
|
*/
|
|
204
204
|
watch?: boolean;
|
|
205
205
|
}
|
|
206
|
-
export interface
|
|
206
|
+
export interface NormalizedNxAppWebpackPluginOptions extends NxAppWebpackPluginOptions {
|
|
207
207
|
projectName: string;
|
|
208
208
|
root: string;
|
|
209
209
|
projectRoot: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Compiler } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { NxAppWebpackPluginOptions } from './nx-app-webpack-plugin-options';
|
|
3
3
|
/**
|
|
4
4
|
* This plugin provides features to build Node and Web applications.
|
|
5
5
|
* - TS support (including tsconfig paths)
|
|
@@ -10,8 +10,8 @@ import { NxWebpackPluginOptions } from './nx-webpack-plugin-options';
|
|
|
10
10
|
*
|
|
11
11
|
* Web-only features, such as stylesheets and images, are only supported when `target` is 'web' or 'webworker'.
|
|
12
12
|
*/
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class NxAppWebpackPlugin {
|
|
14
14
|
private readonly options;
|
|
15
|
-
constructor(options?:
|
|
15
|
+
constructor(options?: NxAppWebpackPluginOptions);
|
|
16
16
|
apply(compiler: Compiler): void;
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.NxAppWebpackPlugin = void 0;
|
|
4
4
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
5
5
|
const fs_1 = require("../../utils/fs");
|
|
6
6
|
const apply_base_config_1 = require("./lib/apply-base-config");
|
|
@@ -15,7 +15,7 @@ const apply_web_config_1 = require("./lib/apply-web-config");
|
|
|
15
15
|
*
|
|
16
16
|
* Web-only features, such as stylesheets and images, are only supported when `target` is 'web' or 'webworker'.
|
|
17
17
|
*/
|
|
18
|
-
class
|
|
18
|
+
class NxAppWebpackPlugin {
|
|
19
19
|
constructor(options = {}) {
|
|
20
20
|
// If we're building inferred targets, skip normalizing build options.
|
|
21
21
|
if (!global.NX_GRAPH_CREATION) {
|
|
@@ -45,4 +45,4 @@ class NxWebpackPlugin {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
exports.
|
|
48
|
+
exports.NxAppWebpackPlugin = NxAppWebpackPlugin;
|
package/src/utils/with-nx.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NxComposableWebpackPlugin } from './config';
|
|
2
|
-
import {
|
|
3
|
-
export type WithNxOptions = Partial<
|
|
2
|
+
import { NxAppWebpackPluginOptions } from '../plugins/nx-webpack-plugin/nx-app-webpack-plugin-options';
|
|
3
|
+
export type WithNxOptions = Partial<NxAppWebpackPluginOptions>;
|
|
4
4
|
/**
|
|
5
5
|
* @param {WithNxOptions} pluginOptions
|
|
6
6
|
* @returns {NxWebpackPlugin}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NxTsconfigPathsWebpackPlugin } from './src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NxTsconfigPathsWebpackPlugin = void 0;
|
|
4
|
+
var nx_tsconfig_paths_webpack_plugin_1 = require("./src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin");
|
|
5
|
+
Object.defineProperty(exports, "NxTsconfigPathsWebpackPlugin", { enumerable: true, get: function () { return nx_tsconfig_paths_webpack_plugin_1.NxTsconfigPathsWebpackPlugin; } });
|
|
File without changes
|