Skip to content

Commit

Permalink
fix(web): update http-server lookup so it works with pnpm (#12269)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Sep 28, 2022
1 parent bd73e31 commit 4b491c8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions e2e/react/src/react.module-federation.test.ts
Expand Up @@ -8,6 +8,7 @@ import {
readProjectConfig,
runCLI,
runCLIAsync,
runCommand,
uniq,
updateFile,
} from '@nrwl/e2e/utils';
Expand All @@ -19,8 +20,7 @@ describe('React Module Federation', () => {

afterEach(() => cleanupProject());

// TODO: Re-enable this to work with pnpm
xit('should generate host and remote apps', async () => {
it('should generate host and remote apps', async () => {
const shell = uniq('shell');
const remote1 = uniq('remote1');
const remote2 = uniq('remote2');
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('React Module Federation', () => {
`
);

const e2eResults = runCLI(`e2e ${shell}-e2e --no-watch`);
const e2eResults = runCLI(`e2e ${shell}-e2e --no-watch --verbose`);
expect(e2eResults).toContain('All specs passed!');
expect(
await killPorts([
Expand Down
Expand Up @@ -2,6 +2,7 @@ import { ExecutorContext, logger, runExecutor } from '@nrwl/devkit';
import devServerExecutor from '@nrwl/webpack/src/executors/dev-server/dev-server.impl';
import { WebDevServerOptions } from '@nrwl/webpack/src/executors/dev-server/schema';
import { join } from 'path';
import * as chalk from 'chalk';
import {
combineAsyncIterators,
tapAsyncIterator,
Expand Down Expand Up @@ -66,7 +67,9 @@ export default async function* moduleFederationDevServer(
numAwaiting--;
if (numAwaiting === 0) {
logger.info(
`Host is ready: ${options.host ?? 'localhost'}:${options.port ?? 4200}`
`[ ${chalk.green('ready')} ] http://${options.host ?? 'localhost'}:${
options.port ?? 4200
}`
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/module-federation/webpack-utils.ts
Expand Up @@ -90,7 +90,7 @@ export function getNpmPackageSharedConfig(
return undefined;
}

return { singleton: true, strictVersion: true, requiredVersion: version };
return { singleton: true, requiredVersion: version };
}

export function sharePackages(
Expand Down
2 changes: 1 addition & 1 deletion packages/web/package.json
Expand Up @@ -50,7 +50,7 @@
"babel-plugin-transform-typescript-metadata": "^0.3.1",
"chalk": "4.1.0",
"chokidar": "^3.5.1",
"http-server": "14.1.0",
"http-server": "^14.1.0",
"ignore": "^5.0.4",
"tslib": "^2.3.0"
},
Expand Down
6 changes: 4 additions & 2 deletions packages/web/src/executors/file-server/file-server.impl.ts
Expand Up @@ -159,8 +159,10 @@ export default async function* fileServerExecutor(

const args = getHttpServerArgs(options);

const { path: pathToHttpServerPkgJson, packageJson } =
readModulePackageJson('http-server');
const { path: pathToHttpServerPkgJson, packageJson } = readModulePackageJson(
'http-server',
module.paths
);
const pathToHttpServerBin = packageJson.bin['http-server'];
const pathToHttpServer = resolve(
pathToHttpServerPkgJson.replace('package.json', ''),
Expand Down

0 comments on commit 4b491c8

Please sign in to comment.