@nx/webpack 23.1.0-rc.1 → 23.1.0-rc.3
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/dist/src/plugins/generate-package-json-plugin.d.ts +1 -1
- package/dist/src/plugins/generate-package-json-plugin.js +3 -3
- package/dist/src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.d.ts +1 -1
- package/dist/src/plugins/nx-webpack-plugin/lib/apply-base-config.d.ts +1 -1
- package/dist/src/plugins/nx-webpack-plugin/lib/apply-base-config.js +8 -8
- package/dist/src/plugins/nx-webpack-plugin/lib/apply-web-config.d.ts +1 -1
- package/dist/src/plugins/nx-webpack-plugin/lib/apply-web-config.js +7 -7
- package/dist/src/plugins/nx-webpack-plugin/lib/instantiate-script-plugins.d.ts +1 -1
- package/dist/src/plugins/nx-webpack-plugin/lib/stylesheet-loaders.js +3 -1
- package/dist/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin.d.ts +1 -1
- package/dist/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin.js +5 -4
- package/dist/src/plugins/stats-json-plugin.d.ts +1 -1
- package/dist/src/plugins/stats-json-plugin.js +2 -2
- package/dist/src/plugins/write-index-html-plugin.d.ts +1 -1
- package/dist/src/plugins/write-index-html-plugin.js +2 -2
- package/dist/src/utils/config.d.ts +1 -1
- package/dist/src/utils/create-copy-plugin.d.ts +1 -2
- package/dist/src/utils/create-copy-plugin.js +2 -3
- package/dist/src/utils/webpack/plugins/postcss-cli-resources.d.ts +1 -1
- package/dist/src/utils/webpack/plugins/scripts-webpack-plugin.d.ts +2 -2
- package/dist/src/utils/webpack/plugins/scripts-webpack-plugin.js +3 -3
- package/dist/src/utils/webpack/read-webpack-options.d.ts +1 -1
- package/dist/src/utils/with-nx.js +3 -2
- package/dist/src/utils/with-web.js +3 -2
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Compiler, WebpackPluginInstance } from 'webpack';
|
|
2
2
|
import { type ProjectGraph } from '@nx/devkit';
|
|
3
3
|
export declare class GeneratePackageJsonPlugin implements WebpackPluginInstance {
|
|
4
4
|
private readonly options;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GeneratePackageJsonPlugin = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
-
const webpack_1 = require("webpack");
|
|
7
6
|
const js_1 = require("@nx/js");
|
|
8
7
|
const devkit_1 = require("@nx/devkit");
|
|
9
8
|
const pluginName = 'GeneratePackageJsonPlugin';
|
|
@@ -25,6 +24,7 @@ class GeneratePackageJsonPlugin {
|
|
|
25
24
|
return runtimeDependencies;
|
|
26
25
|
}
|
|
27
26
|
apply(compiler) {
|
|
27
|
+
const { sources } = require('webpack');
|
|
28
28
|
compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
|
|
29
29
|
compilation.hooks.processAssets.tap({
|
|
30
30
|
name: pluginName,
|
|
@@ -55,7 +55,7 @@ class GeneratePackageJsonPlugin {
|
|
|
55
55
|
...packageJson.dependencies,
|
|
56
56
|
...runtimeDependencies,
|
|
57
57
|
};
|
|
58
|
-
compilation.emitAsset('package.json', new
|
|
58
|
+
compilation.emitAsset('package.json', new sources.RawSource((0, devkit_1.serializeJson)(packageJson)));
|
|
59
59
|
const packageManager = (0, devkit_1.detectPackageManager)(this.options.root);
|
|
60
60
|
if (packageManager === 'bun') {
|
|
61
61
|
compilation
|
|
@@ -63,7 +63,7 @@ class GeneratePackageJsonPlugin {
|
|
|
63
63
|
.warn('Bun lockfile generation is not supported. Only package.json will be generated.');
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
-
compilation.emitAsset((0, js_1.getLockFileName)(packageManager), new
|
|
66
|
+
compilation.emitAsset((0, js_1.getLockFileName)(packageManager), new sources.RawSource((0, js_1.createLockFile)(packageJson, this.options.projectGraph, packageManager)));
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Compiler,
|
|
1
|
+
import type { Compiler, Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
2
2
|
import { NormalizedNxAppWebpackPluginOptions } from '../nx-webpack-plugin/nx-app-webpack-plugin-options';
|
|
3
3
|
export declare class NxTsconfigPathsWebpackPlugin {
|
|
4
4
|
private options;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
1
|
+
import type { Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
2
2
|
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
3
3
|
export declare function applyBaseConfig(options: NormalizedNxAppWebpackPluginOptions, config?: Partial<WebpackOptionsNormalized | Configuration>, { useNormalizedEntry, }?: {
|
|
4
4
|
useNormalizedEntry?: boolean;
|
|
@@ -3,9 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.applyBaseConfig = applyBaseConfig;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path = tslib_1.__importStar(require("path"));
|
|
6
|
-
const license_webpack_plugin_1 = require("license-webpack-plugin");
|
|
7
|
-
const copy_webpack_plugin_1 = tslib_1.__importDefault(require("copy-webpack-plugin"));
|
|
8
|
-
const webpack_1 = require("webpack");
|
|
9
6
|
const js_1 = require("@nx/js");
|
|
10
7
|
const stats_json_plugin_1 = require("../../stats-json-plugin");
|
|
11
8
|
const generate_package_json_plugin_1 = require("../../generate-package-json-plugin");
|
|
@@ -13,8 +10,6 @@ const hash_format_1 = require("../../../utils/hash-format");
|
|
|
13
10
|
const nx_tsconfig_paths_webpack_plugin_1 = require("../../nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin");
|
|
14
11
|
const get_terser_ecma_version_1 = require("./get-terser-ecma-version");
|
|
15
12
|
const compiler_loaders_1 = require("./compiler-loaders");
|
|
16
|
-
const TerserPlugin = require("terser-webpack-plugin");
|
|
17
|
-
const nodeExternals = require("webpack-node-externals");
|
|
18
13
|
const internal_1 = require("@nx/js/internal");
|
|
19
14
|
const utils_1 = require("./utils");
|
|
20
15
|
const IGNORED_WEBPACK_WARNINGS = [
|
|
@@ -43,6 +38,7 @@ function applyBaseConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
43
38
|
applyNxDependentConfig(options, config, { useNormalizedEntry });
|
|
44
39
|
}
|
|
45
40
|
function applyNxIndependentConfig(options, config) {
|
|
41
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
46
42
|
const hashFormat = (0, hash_format_1.getOutputHashFormat)(options.outputHashing);
|
|
47
43
|
config.context = path.join(options.root, options.projectRoot);
|
|
48
44
|
config.target ??= options.target;
|
|
@@ -199,6 +195,10 @@ function applyNxIndependentConfig(options, config) {
|
|
|
199
195
|
config.externals ??= [];
|
|
200
196
|
}
|
|
201
197
|
function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
198
|
+
const { ProgressPlugin } = require('webpack');
|
|
199
|
+
const { LicenseWebpackPlugin } = require('license-webpack-plugin');
|
|
200
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
201
|
+
const nodeExternals = require('webpack-node-externals');
|
|
202
202
|
const tsConfig = options.tsConfig ?? (0, js_1.getRootTsConfigPath)();
|
|
203
203
|
const plugins = [];
|
|
204
204
|
const executorContext = {
|
|
@@ -283,10 +283,10 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
285
|
if (options.progress) {
|
|
286
|
-
plugins.push(new
|
|
286
|
+
plugins.push(new ProgressPlugin({ profile: options.verbose }));
|
|
287
287
|
}
|
|
288
288
|
if (options.extractLicenses) {
|
|
289
|
-
plugins.push(new
|
|
289
|
+
plugins.push(new LicenseWebpackPlugin({
|
|
290
290
|
stats: {
|
|
291
291
|
warnings: false,
|
|
292
292
|
errors: false,
|
|
@@ -296,7 +296,7 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
|
|
|
296
296
|
}));
|
|
297
297
|
}
|
|
298
298
|
if (Array.isArray(options.assets) && options.assets.length > 0) {
|
|
299
|
-
plugins.push(new
|
|
299
|
+
plugins.push(new CopyWebpackPlugin({
|
|
300
300
|
patterns: options.assets.map((asset) => {
|
|
301
301
|
return {
|
|
302
302
|
context: asset.input,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
1
|
+
import type { Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
2
2
|
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
3
3
|
export declare function applyWebConfig(options: NormalizedNxAppWebpackPluginOptions, config?: Partial<WebpackOptionsNormalized | Configuration>, { useNormalizedEntry, }?: {
|
|
4
4
|
useNormalizedEntry?: boolean;
|
|
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.applyWebConfig = applyWebConfig;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path = tslib_1.__importStar(require("path"));
|
|
6
|
-
const webpack_subresource_integrity_1 = require("webpack-subresource-integrity");
|
|
7
|
-
const webpack_1 = require("webpack");
|
|
8
6
|
const write_index_html_plugin_1 = require("../../write-index-html-plugin");
|
|
9
7
|
const hash_format_1 = require("../../../utils/hash-format");
|
|
10
8
|
const get_client_environment_1 = require("../../../utils/get-client-environment");
|
|
11
9
|
const normalize_entry_1 = require("../../../utils/webpack/normalize-entry");
|
|
12
10
|
const stylesheet_loaders_1 = require("./stylesheet-loaders");
|
|
13
11
|
const instantiate_script_plugins_1 = require("./instantiate-script-plugins");
|
|
14
|
-
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|
15
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
16
12
|
function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
17
13
|
if (global.NX_GRAPH_CREATION)
|
|
18
14
|
return;
|
|
15
|
+
const { DefinePlugin, ids } = require('webpack');
|
|
16
|
+
const { SubresourceIntegrityPlugin } = require('webpack-subresource-integrity');
|
|
17
|
+
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
18
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
19
19
|
// Defaults that was applied from executor schema previously.
|
|
20
20
|
options.runtimeChunk ??= true; // need this for HMR and other things to work
|
|
21
21
|
options.extractCss ??= true;
|
|
@@ -42,16 +42,16 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
42
42
|
}));
|
|
43
43
|
}
|
|
44
44
|
if (options.subresourceIntegrity) {
|
|
45
|
-
plugins.push(new
|
|
45
|
+
plugins.push(new SubresourceIntegrityPlugin());
|
|
46
46
|
}
|
|
47
|
-
const minimizer = [new
|
|
47
|
+
const minimizer = [new ids.HashedModuleIdsPlugin()];
|
|
48
48
|
if (stylesOptimization) {
|
|
49
49
|
minimizer.push(new CssMinimizerPlugin({
|
|
50
50
|
test: /\.(?:css|scss|sass|less)$/,
|
|
51
51
|
}));
|
|
52
52
|
}
|
|
53
53
|
if (!options.ssr) {
|
|
54
|
-
plugins.push(new
|
|
54
|
+
plugins.push(new DefinePlugin((0, get_client_environment_1.getClientEnvironment)(process.env.NODE_ENV).stringified));
|
|
55
55
|
}
|
|
56
56
|
const entries = {};
|
|
57
57
|
const globalStylePaths = [];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { WebpackPluginInstance } from 'webpack';
|
|
1
|
+
import type { WebpackPluginInstance } from 'webpack';
|
|
2
2
|
import { NormalizedNxAppWebpackPluginOptions } from '../nx-app-webpack-plugin-options';
|
|
3
3
|
export declare function instantiateScriptPlugins(options: NormalizedNxAppWebpackPluginOptions): WebpackPluginInstance[];
|
|
@@ -7,11 +7,11 @@ const tslib_1 = require("tslib");
|
|
|
7
7
|
const path = tslib_1.__importStar(require("path"));
|
|
8
8
|
const autoprefixer = require("autoprefixer");
|
|
9
9
|
const postcssImports = require("postcss-import");
|
|
10
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
11
10
|
const get_css_module_local_ident_1 = require("../../../utils/get-css-module-local-ident");
|
|
12
11
|
const hash_format_1 = require("../../../utils/hash-format");
|
|
13
12
|
const postcss_cli_resources_1 = require("../../../utils/webpack/plugins/postcss-cli-resources");
|
|
14
13
|
function getCommonLoadersForCssModules(options, includePaths) {
|
|
14
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
15
15
|
// load component css as raw strings
|
|
16
16
|
return [
|
|
17
17
|
{
|
|
@@ -42,6 +42,7 @@ function getCommonLoadersForCssModules(options, includePaths) {
|
|
|
42
42
|
];
|
|
43
43
|
}
|
|
44
44
|
function getCommonLoadersForGlobalCss(options, includePaths) {
|
|
45
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
45
46
|
return [
|
|
46
47
|
{
|
|
47
48
|
loader: options.extractCss
|
|
@@ -61,6 +62,7 @@ function getCommonLoadersForGlobalCss(options, includePaths) {
|
|
|
61
62
|
];
|
|
62
63
|
}
|
|
63
64
|
function getCommonLoadersForGlobalStyle(options, includePaths) {
|
|
65
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
64
66
|
return [
|
|
65
67
|
{
|
|
66
68
|
loader: options.extractCss
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NxAppWebpackPlugin = void 0;
|
|
4
4
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
5
|
-
const apply_base_config_1 = require("./lib/apply-base-config");
|
|
6
|
-
const apply_web_config_1 = require("./lib/apply-web-config");
|
|
7
5
|
/**
|
|
8
6
|
* This plugin provides features to build Node and Web applications.
|
|
9
7
|
* - TS support (including tsconfig paths)
|
|
@@ -22,20 +20,23 @@ class NxAppWebpackPlugin {
|
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
apply(compiler) {
|
|
23
|
+
// Lazy-required so a generator can load this without the webpack bundler.
|
|
24
|
+
const { applyBaseConfig } = require('./lib/apply-base-config');
|
|
25
|
+
const { applyWebConfig } = require('./lib/apply-web-config');
|
|
25
26
|
// Defaults to 'web' if not specified to match Webpack's default.
|
|
26
27
|
const target = this.options.target ?? compiler.options.target ?? 'web';
|
|
27
28
|
this.options.outputPath ??= compiler.options.output?.path;
|
|
28
29
|
if (typeof target === 'string') {
|
|
29
30
|
this.options.target = target;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
applyBaseConfig(this.options, compiler.options, {
|
|
32
33
|
useNormalizedEntry: true,
|
|
33
34
|
});
|
|
34
35
|
if (compiler.options.target) {
|
|
35
36
|
this.options.target = compiler.options.target;
|
|
36
37
|
}
|
|
37
38
|
if (this.options.target === 'web' || this.options.target === 'webworker') {
|
|
38
|
-
|
|
39
|
+
applyWebConfig(this.options, compiler.options, {
|
|
39
40
|
useNormalizedEntry: true,
|
|
40
41
|
});
|
|
41
42
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StatsJsonPlugin = void 0;
|
|
4
|
-
const webpack_1 = require("webpack");
|
|
5
4
|
class StatsJsonPlugin {
|
|
6
5
|
apply(compiler) {
|
|
6
|
+
const { sources } = require('webpack');
|
|
7
7
|
compiler.hooks.emit.tap('StatsJsonPlugin', (compilation) => {
|
|
8
8
|
const data = JSON.stringify(compilation.getStats().toJson('verbose'));
|
|
9
|
-
compilation.assets[`stats.json`] = new
|
|
9
|
+
compilation.assets[`stats.json`] = new sources.RawSource(data);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WriteIndexHtmlPlugin = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const webpack = tslib_1.__importStar(require("webpack"));
|
|
6
4
|
const crypto_1 = require("crypto");
|
|
7
5
|
const fs_1 = require("fs");
|
|
8
6
|
const interpolate_env_variables_to_index_1 = require("../utils/webpack/interpolate-env-variables-to-index");
|
|
@@ -14,6 +12,7 @@ class WriteIndexHtmlPlugin {
|
|
|
14
12
|
this.options = options;
|
|
15
13
|
}
|
|
16
14
|
apply(compiler) {
|
|
15
|
+
const webpack = require('webpack');
|
|
17
16
|
const { outputPath, indexPath, baseHref, deployUrl, sri = false, scripts = [], styles = [], crossOrigin, } = this.options;
|
|
18
17
|
compiler.hooks.thisCompilation.tap('WriteIndexHtmlPlugin', (compilation) => {
|
|
19
18
|
compilation.hooks.processAssets.tap({
|
|
@@ -71,6 +70,7 @@ class WriteIndexHtmlPlugin {
|
|
|
71
70
|
return data.replace(/^\uFEFF/, '');
|
|
72
71
|
}
|
|
73
72
|
augmentIndexHtml(params) {
|
|
73
|
+
const webpack = require('webpack');
|
|
74
74
|
const { loadOutputFile, files, moduleFiles = [], entrypoints } = params;
|
|
75
75
|
let { crossOrigin = 'none' } = params;
|
|
76
76
|
if (params.sri && crossOrigin === 'none') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { Configuration } from 'webpack';
|
|
2
|
+
import type { Configuration } from 'webpack';
|
|
3
3
|
import { NormalizedWebpackExecutorOptions } from '../executors/webpack/schema';
|
|
4
4
|
export declare const nxWebpackComposablePlugin = "nxWebpackComposablePlugin";
|
|
5
5
|
export declare function isNxWebpackComposablePlugin(a: unknown): a is AsyncNxComposableWebpackPlugin;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
|
2
1
|
import { AssetGlobPattern } from '../executors/webpack/schema';
|
|
3
|
-
export declare function createCopyPlugin(assets: AssetGlobPattern[]):
|
|
2
|
+
export declare function createCopyPlugin(assets: AssetGlobPattern[]): import("copy-webpack-plugin");
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCopyPlugin = createCopyPlugin;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const copy_webpack_plugin_1 = tslib_1.__importDefault(require("copy-webpack-plugin"));
|
|
6
4
|
function createCopyPlugin(assets) {
|
|
7
|
-
|
|
5
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
6
|
+
return new CopyWebpackPlugin({
|
|
8
7
|
patterns: assets.map((asset) => {
|
|
9
8
|
return {
|
|
10
9
|
context: asset.input,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import type * as Webpack from 'webpack';
|
|
2
2
|
export interface ScriptsWebpackPluginOptions {
|
|
3
3
|
name: string;
|
|
4
4
|
sourceMap: boolean;
|
|
@@ -13,5 +13,5 @@ export declare class ScriptsWebpackPlugin {
|
|
|
13
13
|
constructor(options?: Partial<ScriptsWebpackPluginOptions>);
|
|
14
14
|
shouldSkip(compilation: any, scripts: string[]): boolean;
|
|
15
15
|
private _insertOutput;
|
|
16
|
-
apply(compiler:
|
|
16
|
+
apply(compiler: Webpack.Compiler): void;
|
|
17
17
|
}
|
|
@@ -4,9 +4,6 @@ exports.ScriptsWebpackPlugin = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const loader_utils_1 = require("loader-utils");
|
|
6
6
|
const path = tslib_1.__importStar(require("path"));
|
|
7
|
-
const webpack = tslib_1.__importStar(require("webpack"));
|
|
8
|
-
const Chunk = require('webpack/lib/Chunk');
|
|
9
|
-
const EntryPoint = require('webpack/lib/Entrypoint');
|
|
10
7
|
function addDependencies(compilation, scripts) {
|
|
11
8
|
for (const script of scripts) {
|
|
12
9
|
compilation.fileDependencies.add(script);
|
|
@@ -36,6 +33,8 @@ class ScriptsWebpackPlugin {
|
|
|
36
33
|
return true;
|
|
37
34
|
}
|
|
38
35
|
_insertOutput(compilation, { filename, source }, cached = false) {
|
|
36
|
+
const Chunk = require('webpack/lib/Chunk');
|
|
37
|
+
const EntryPoint = require('webpack/lib/Entrypoint');
|
|
39
38
|
const chunk = new Chunk(this.options.name);
|
|
40
39
|
chunk.rendered = !cached;
|
|
41
40
|
chunk.id = this.options.name;
|
|
@@ -62,6 +61,7 @@ class ScriptsWebpackPlugin {
|
|
|
62
61
|
if (!this.options.scripts || this.options.scripts.length === 0) {
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
64
|
+
const webpack = require('webpack');
|
|
65
65
|
const scripts = this.options.scripts
|
|
66
66
|
.filter((script) => !!script)
|
|
67
67
|
.map((script) => path.resolve(this.options.basePath || '', script));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withNx = withNx;
|
|
4
|
-
const apply_base_config_1 = require("../plugins/nx-webpack-plugin/lib/apply-base-config");
|
|
5
4
|
const normalize_options_1 = require("../plugins/nx-webpack-plugin/lib/normalize-options");
|
|
6
5
|
const deprecation_1 = require("./deprecation");
|
|
7
6
|
const processed = new Set();
|
|
@@ -18,7 +17,9 @@ function withNx(pluginOptions = {}) {
|
|
|
18
17
|
return function configure(config, { options, context }) {
|
|
19
18
|
if (processed.has(config))
|
|
20
19
|
return config;
|
|
21
|
-
|
|
20
|
+
// Lazy-required so importing this module does not load the webpack bundler.
|
|
21
|
+
const { applyBaseConfig } = require('../plugins/nx-webpack-plugin/lib/apply-base-config');
|
|
22
|
+
applyBaseConfig({
|
|
22
23
|
...options,
|
|
23
24
|
...pluginOptions,
|
|
24
25
|
target: options.target ?? 'web',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withWeb = withWeb;
|
|
4
|
-
const apply_web_config_1 = require("../plugins/nx-webpack-plugin/lib/apply-web-config");
|
|
5
4
|
const deprecation_1 = require("./deprecation");
|
|
6
5
|
const processed = new Set();
|
|
7
6
|
/**
|
|
@@ -17,7 +16,9 @@ function withWeb(pluginOptions = {}) {
|
|
|
17
16
|
return function configure(config, { options, context }) {
|
|
18
17
|
if (processed.has(config))
|
|
19
18
|
return config;
|
|
20
|
-
|
|
19
|
+
// Lazy-required so importing this module does not load the webpack bundler.
|
|
20
|
+
const { applyWebConfig } = require('../plugins/nx-webpack-plugin/lib/apply-web-config');
|
|
21
|
+
applyWebConfig({
|
|
21
22
|
...options,
|
|
22
23
|
...pluginOptions,
|
|
23
24
|
projectName: context.projectName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "23.1.0-rc.
|
|
3
|
+
"version": "23.1.0-rc.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
"tslib": "^2.3.0",
|
|
119
119
|
"webpack-node-externals": "^3.0.0",
|
|
120
120
|
"webpack-subresource-integrity": "^5.1.0",
|
|
121
|
-
"@nx/devkit": "23.1.0-rc.
|
|
122
|
-
"@nx/js": "23.1.0-rc.
|
|
121
|
+
"@nx/devkit": "23.1.0-rc.3",
|
|
122
|
+
"@nx/js": "23.1.0-rc.3"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"webpack": "^5.0.0",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
141
|
-
"nx": "23.1.0-rc.
|
|
141
|
+
"nx": "23.1.0-rc.3"
|
|
142
142
|
},
|
|
143
143
|
"publishConfig": {
|
|
144
144
|
"access": "public"
|