@nx/webpack 17.2.5 → 17.2.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/README.md CHANGED
@@ -1,9 +1,4 @@
1
- <p style="text-align: center;">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4
- <img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5
- </picture>
6
- </p>
1
+ <p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
7
2
 
8
3
  <div style="text-align: center;">
9
4
 
@@ -20,9 +15,9 @@
20
15
 
21
16
  <hr>
22
17
 
23
- # Nx: Smart Monorepos · Fast CI
18
+ # Nx: Smart, Fast and Extensible Build System
24
19
 
25
- Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
20
+ Nx is a next generation build system with first class monorepo support and powerful integrations.
26
21
 
27
22
  This package is a [Webpack plugin for Nx](https://nx.dev/packages/webpack).
28
23
 
@@ -64,5 +59,5 @@ npx nx@latest init
64
59
  - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
65
60
 
66
61
  <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
67
- width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
62
+ width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
68
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "v17.2.5",
3
+ "version": "17.2.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": {
@@ -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": "v17.2.5",
66
- "@nx/js": "v17.2.5",
67
- "@nrwl/webpack": "v17.2.5"
65
+ "@nx/devkit": "17.2.7",
66
+ "@nx/js": "17.2.7",
67
+ "@nrwl/webpack": "17.2.7"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"
@@ -18,6 +18,8 @@ async function* devServerExecutor(serveOptions, context) {
18
18
  process.env.NODE_ENV ??= 'development';
19
19
  const { root: projectRoot, sourceRoot } = context.projectsConfigurations.projects[context.projectName];
20
20
  const buildOptions = (0, normalize_options_1.normalizeOptions)(getBuildOptions(serveOptions, context), context.root, projectRoot, sourceRoot);
21
+ process.env.NX_BUILD_LIBS_FROM_SOURCE = `${buildOptions.buildLibsFromSource}`;
22
+ process.env.NX_BUILD_TARGET = serveOptions.buildTarget;
21
23
  // TODO(jack): Figure out a way to port this into NxWebpackPlugin
22
24
  if (!buildOptions.buildLibsFromSource) {
23
25
  if (!buildOptions.tsConfig) {
@@ -26,6 +28,7 @@ async function* devServerExecutor(serveOptions, context) {
26
28
  const { target, dependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, 'build', // should be generalized
27
29
  context.configurationName);
28
30
  buildOptions.tsConfig = (0, buildable_libs_utils_1.createTmpTsConfig)(buildOptions.tsConfig, context.root, target.data.root, dependencies);
31
+ process.env.NX_TSCONFIG_PATH = buildOptions.tsConfig;
29
32
  }
30
33
  let config;
31
34
  const devServer = (0, get_dev_server_config_1.getDevServerOptions)(context.root, serveOptions, buildOptions);
@@ -64,6 +64,12 @@ async function* webpackExecutor(_options, context) {
64
64
  process.env.NODE_ENV ||= isScriptOptimizeOn
65
65
  ? 'production'
66
66
  : 'development';
67
+ process.env.NX_BUILD_LIBS_FROM_SOURCE = `${options.buildLibsFromSource}`;
68
+ process.env.NX_BUILD_TARGET = (0, devkit_1.targetToTargetString)({
69
+ project: context.projectName,
70
+ target: context.targetName,
71
+ configuration: context.configurationName,
72
+ });
67
73
  if (options.compiler === 'swc') {
68
74
  try {
69
75
  require.resolve('swc-loader');
@@ -80,6 +86,7 @@ async function* webpackExecutor(_options, context) {
80
86
  if (!options.buildLibsFromSource && context.targetName) {
81
87
  const { dependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
82
88
  options.tsConfig = (0, buildable_libs_utils_1.createTmpTsConfig)(options.tsConfig, context.root, metadata.root, dependencies);
89
+ process.env.NX_TSCONFIG_PATH = options.tsConfig;
83
90
  }
84
91
  // Delete output path before bundling
85
92
  if (options.deleteOutputPath && options.outputPath) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDependentPackagesForProject = void 0;
4
4
  const typescript_1 = require("./typescript");
5
+ const devkit_1 = require("@nx/devkit");
5
6
  function getDependentPackagesForProject(projectGraph, name) {
6
7
  const { npmPackages, workspaceLibraries } = collectDependencies(projectGraph, name);
7
8
  return {
@@ -34,11 +35,22 @@ function collectDependencies(projectGraph, name, dependencies = {
34
35
  return dependencies;
35
36
  }
36
37
  function getLibraryImportPath(library, projectGraph) {
38
+ let buildLibsFromSource = true;
39
+ if (process.env.NX_BUILD_LIBS_FROM_SOURCE) {
40
+ buildLibsFromSource = process.env.NX_BUILD_LIBS_FROM_SOURCE === 'true';
41
+ }
42
+ const libraryNode = projectGraph.nodes[library];
43
+ let sourceRoots = [libraryNode.data.sourceRoot];
44
+ if (!buildLibsFromSource && process.env.NX_BUILD_TARGET) {
45
+ const buildTarget = (0, devkit_1.parseTargetString)(process.env.NX_BUILD_TARGET, projectGraph);
46
+ sourceRoots = (0, devkit_1.getOutputsForTargetAndConfiguration)(buildTarget, {}, libraryNode);
47
+ }
37
48
  const tsConfigPathMappings = (0, typescript_1.readTsPathMappings)();
38
- const sourceRoot = projectGraph.nodes[library].data.sourceRoot;
39
49
  for (const [key, value] of Object.entries(tsConfigPathMappings)) {
40
- if (value.find((path) => path.startsWith(sourceRoot))) {
41
- return key;
50
+ for (const src of sourceRoots) {
51
+ if (value.find((path) => path.startsWith(src))) {
52
+ return key;
53
+ }
42
54
  }
43
55
  }
44
56
  return undefined;