Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module federation failure in wildcard ts mapping #29477

Open
1 of 4 tasks
jmvtrinidad opened this issue Dec 27, 2024 · 0 comments
Open
1 of 4 tasks

module federation failure in wildcard ts mapping #29477

jmvtrinidad opened this issue Dec 27, 2024 · 0 comments

Comments

@jmvtrinidad
Copy link

jmvtrinidad commented Dec 27, 2024

Current Behavior

it throws an error when building, looks like related to this issue
Image
library.name has value @company/app/config/*

Expected Behavior

handle wildcard ts import

GitHub Repo

No response

Steps to Reproduce

  1. build app with wildcard

Nx Report

Node           : 22.4.0
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 9.15.0

nx (global)            : 20.2.2
nx                     : 20.3.0
@nx/js                 : 20.3.0
@nx/jest               : 20.3.0
@nx/eslint             : 20.3.0
@nx/workspace          : 20.3.0
@nx/devkit             : 20.3.0
@nx/eslint-plugin      : 20.3.0
@nx/module-federation  : 20.3.0
@nx/plugin             : 20.3.0
@nx/react              : 20.3.0
@nx/rspack             : 20.3.0
@nx/storybook          : 20.3.0
@nx/vite               : 20.3.0
@nx/web                : 20.3.0
@nx/webpack            : 20.3.0
nx-cloud               : 19.1.0
typescript             : 5.6.3
---------------------------------------
Community plugins:
@koliveira15/nx-sonarqube : 3.5.1
@nx-tools/nx-container    : 6.2.0
---------------------------------------
Local workspace plugins:
         fe-tools

Failure Logs

× TypeError: The "path" argument must be of type string. Received undefined
│     at join (node:path:1175:7)
│     at /app/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]._6allat2eyhmrem2zood2ybjpjq/node_modules/@nx/module-federation/src/utils/share.js:117:45
│     at Object.fn (/app/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rspack/core/dist/index.js:18922:15)
│     at next (/app/node_modules/.pnpm/@[email protected]/node_modules/@rspack/lite-tapable/dist/index.js:619:29)
│     at AsyncSeriesBailHook.callAsyncStageRange (/app/node_modules/.pnpm/@[email protected]/node_modules/@rspack/lite-tapable/dist/index.js:642:9)
│     at /app/node_modules/.pnpm/@[email protected]/node_modules/@rspack/lite-tapable/dist/index.js:86:18
│     at new Promise (<anonymous>)
│     a

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

when i try to replace the share.js with below code it builds fine

              let newReq = req.request
              try {
                newReq = library.name.endsWith('/*')
                    ? /**
                       * req usually is in the form of "../../../path/to/file"
                       * library.path is usually in the form of "/Users/username/path/to/Workspace/path/to/library"
                       *
                       * When a wildcard is used in the TS path mappings, we want to get everything after the import to
                       * re-route the request correctly inline with the webpack/rspack resolve.alias
                       */
                        (0, path_1.join)(library.name, req.request.split(library.path.replace(devkit_1.workspaceRoot, '').replace('/*', ''))[1])
                    : library.name;
              } catch (e) {
              }
              req.request = newReq;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant