Skip to content

Commit

Permalink
fix(webpack): regression from #10432 to allow // prefix in remote (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
neo committed Sep 29, 2022
1 parent a592af1 commit ba657da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/angular/src/utils/mf/with-module-federation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
readCachedProjectGraph,
} from '@nrwl/devkit';
import { readCachedProjectConfiguration } from 'nx/src/project-graph/project-graph';
import { extname, join } from 'path';
import { extname } from 'path';
import {
getNpmPackageSharedConfig,
SharedLibraryConfig,
Expand Down Expand Up @@ -59,7 +59,11 @@ function mapRemotes(remotes: MFRemotes) {
const remoteLocationExt = extname(remoteLocation);
mappedRemotes[remoteName] = ['.js', '.mjs'].includes(remoteLocationExt)
? remoteLocation
: join(remoteLocation, 'remoteEntry.mjs');
: `${
remoteLocation.endsWith('/')
? remoteLocation.slice(0, -1)
: remoteLocation
}/remoteEntry.mjs`;
} else if (typeof remote === 'string') {
mappedRemotes[remote] = determineRemoteUrl(remote);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
SharedLibraryConfig,
} from './models';
import { readRootPackageJson } from './package-json';
import { extname, join } from 'path';
import { extname } from 'path';
import ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');

function collectDependencies(
Expand Down Expand Up @@ -133,7 +133,11 @@ function mapRemotes(remotes: Remotes, projectGraph: ProjectGraph) {
const remoteLocationExt = extname(remoteLocation);
mappedRemotes[remoteName] = ['.js', '.mjs'].includes(remoteLocationExt)
? remoteLocation
: join(remoteLocation, 'remoteEntry.js');
: `${
remoteLocation.endsWith('/')
? remoteLocation.slice(0, -1)
: remoteLocation
}/remoteEntry.js`;
} else if (typeof remote === 'string') {
mappedRemotes[remote] = determineRemoteUrl(remote, projectGraph);
}
Expand Down

0 comments on commit ba657da

Please sign in to comment.