@nx/webpack 17.2.0-beta.5 → 17.2.0-beta.8

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": "17.2.0-beta.5",
3
+ "version": "17.2.0-beta.8",
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,9 +62,9 @@
62
62
  "webpack-dev-server": "^4.9.3",
63
63
  "webpack-node-externals": "^3.0.0",
64
64
  "webpack-subresource-integrity": "^5.1.0",
65
- "@nx/devkit": "17.2.0-beta.5",
66
- "@nx/js": "17.2.0-beta.5",
67
- "@nrwl/webpack": "17.2.0-beta.5"
65
+ "@nx/devkit": "17.2.0-beta.8",
66
+ "@nx/js": "17.2.0-beta.8",
67
+ "@nrwl/webpack": "17.2.0-beta.8"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"
@@ -13,6 +13,7 @@ function normalizeOptions(options, root, projectRoot, sourceRoot) {
13
13
  outputFileName: options.outputFileName ?? 'main.js',
14
14
  assets: (0, normalize_options_1.normalizeAssets)(options.assets, root, sourceRoot),
15
15
  webpackConfig: normalizePluginPath(options.webpackConfig, root),
16
+ fileReplacements: (0, normalize_options_1.normalizeFileReplacements)(root, options.fileReplacements),
16
17
  optimization: typeof options.optimization !== 'object'
17
18
  ? {
18
19
  scripts: options.optimization,
@@ -254,11 +254,13 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
254
254
  oneOf: [...cssModuleRules, ...globalCssRules, ...globalStyleRules],
255
255
  },
256
256
  ];
257
- plugins.push(
258
- // extract global css from js files into own css file
259
- new MiniCssExtractPlugin({
260
- filename: `[name]${hashFormat.extract}.css`,
261
- }));
257
+ if (options.extractCss) {
258
+ plugins.push(
259
+ // extract global css from js files into own css file
260
+ new MiniCssExtractPlugin({
261
+ filename: `[name]${hashFormat.extract}.css`,
262
+ }));
263
+ }
262
264
  config.output = {
263
265
  ...config.output,
264
266
  crossOriginLoading: options.subresourceIntegrity
@@ -1,3 +1,4 @@
1
- import { AssetGlobPattern, NormalizedNxWebpackPluginOptions, NxWebpackPluginOptions } from '../nx-webpack-plugin-options';
1
+ import { AssetGlobPattern, FileReplacement, NormalizedNxWebpackPluginOptions, NxWebpackPluginOptions } from '../nx-webpack-plugin-options';
2
2
  export declare function normalizeOptions(options: NxWebpackPluginOptions): NormalizedNxWebpackPluginOptions;
3
3
  export declare function normalizeAssets(assets: any[], root: string, sourceRoot: string): AssetGlobPattern[];
4
+ export declare function normalizeFileReplacements(root: string, fileReplacements: FileReplacement[]): FileReplacement[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeAssets = exports.normalizeOptions = void 0;
3
+ exports.normalizeFileReplacements = exports.normalizeAssets = exports.normalizeOptions = void 0;
4
4
  const path_1 = require("path");
5
5
  const fs_1 = require("fs");
6
6
  const devkit_1 = require("@nx/devkit");
@@ -114,3 +114,4 @@ function normalizeFileReplacements(root, fileReplacements) {
114
114
  }))
115
115
  : [];
116
116
  }
117
+ exports.normalizeFileReplacements = normalizeFileReplacements;
@@ -62,7 +62,9 @@ exports.getCommonLoadersForGlobalCss = getCommonLoadersForGlobalCss;
62
62
  function getCommonLoadersForGlobalStyle(options, includePaths) {
63
63
  return [
64
64
  {
65
- loader: MiniCssExtractPlugin.loader,
65
+ loader: options.extractCss
66
+ ? MiniCssExtractPlugin.loader
67
+ : require.resolve('style-loader'),
66
68
  options: { esModule: true },
67
69
  },
68
70
  { loader: require.resolve('css-loader'), options: { url: false } },