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

@angular-architects/module-federation version 14.3.0 unhandled exception occurred with webpack.config.js #39

Open
jhohlman opened this issue Aug 2, 2023 · 0 comments

Comments

@jhohlman
Copy link

jhohlman commented Aug 2, 2023

When upgrading from @angular-architects/module-federation 14.2.3 to 14.3.0 I am seeing an error (pasted below) when trying to serve the application now.

Generating browser application bundles (phase: setup)...An unhandled exception occurred: The "path" argument must be of type string. Received an instance of Object See "C:\Users\...\AppData\Local\Temp\ng-1b2NOF\angular-errors.log" for further details.

Inside the error log it contains a stack that seems to point to our webpack.config.js as the cause of the error. I pasted what is inside the error log file below:

[error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
    at new NodeError (node:internal/errors:388:5)
    at validateString (node:internal/validators:114:11)
    at Object.join (node:path:429:7)
    at readConfiguredSecondaries (C:\code\client\node_modules\@angular-architects\module-federation\src\utils\share-utils.js:126:94)
    at getSecondaries (C:\code\client\node_modules\@angular-architects\module-federation\src\utils\share-utils.js:96:24)
    at Object.share (C:\code\client\node_modules\@angular-architects\module-federation\src\utils\share-utils.js:175:33)
    at shareAll (C:\code\client\node_modules\@angular-architects\module-federation\src\utils\share-utils.js:143:27)
    at Object.<anonymous> (C:\code\client\webpack.config.js:50:10)
    at Module._compile (node:internal/modules/cjs/loader:1112:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:834:12)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at transforms.<computed> [as webpackConfiguration] (C:\code\client\node_modules\ngx-build-plus\src\utils\index.js:56:38)
    at setup (C:\code\client\node_modules\@angular-devkit\build-angular\src\builders\dev-server\index.js:168:46)

I also pasted what I have in my webpack.config.js below. This error showed up with no changes being made to the webpack.config.js. It just started once we saw the upgrade to the @angular-architects/module-federation 14.3.0 version

const { share,  withModuleFederationPlugin, = require('@angular-architects/module-federation/webpack');

module.exports = withModuleFederationPlugin({
  remotes: { },

  shared: share({
    '@angular/core': { singleton: true, strictVersion: true, requiredVersion: 'auto', },
    '@angular/common': { singleton: true, strictVersion: true, requiredVersion: 'auto', },
    '@angular/common/http': { singleton: true, strictVersion: true, requiredVersion: 'auto', },
    '@angular/router': { singleton: true, strictVersion: true, requiredVersion: 'auto', },
    '@okta/okta-angular': { singleton: true, strictVersion: true, requiredVersion: 'auto', },
    '@okta/okta-auth-js': { singleton: true, strictVersion: true, requiredVersion: 'auto', },
  }),

  sharedMappings: ['auth-lib'],
});

I'm following this article because we want a solution where we don't need to hardcode the URL for the remoteEntry.js file.

To fix this error do we need to adjust how the webpack.config.js file is configured?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant