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

fix(web): update http-server lookup so it works with pnpm #12269

Merged
merged 1 commit into from Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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