From b1adcc7ee8dd7a4fc4974bf822945a01a80c5d2c Mon Sep 17 00:00:00 2001 From: Josh GM Walker <56300765+Josh-Walker-GM@users.noreply.github.com> Date: Tue, 5 Dec 2023 22:30:31 +0000 Subject: [PATCH] chore: Linting and disable some console logs (#9635) --- packages/vite/src/rsc/rscBuildServer.ts | 57 +++++++++++-------------- packages/web/src/config.ts | 7 +-- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/packages/vite/src/rsc/rscBuildServer.ts b/packages/vite/src/rsc/rscBuildServer.ts index f4ea94b1a75f..29667a8e02da 100644 --- a/packages/vite/src/rsc/rscBuildServer.ts +++ b/packages/vite/src/rsc/rscBuildServer.ts @@ -94,37 +94,32 @@ export async function rscBuildServer( // The map function below will return '..' for local files. That's not // very pretty, but it works. It just won't match anything. noExternal: Object.values(clientEntryFiles).map((fullPath) => { - // On Windows `fullPath` will be something like - // D:/a/redwood/test-project-rsc-external-packages/node_modules/@tobbe.dev/rsc-test/dist/rsc-test.es.js - const relativePath = path.relative( - path.join(rwPaths.base, 'node_modules'), - fullPath - ) - // On Windows `relativePath` will be something like - // @tobbe.dev\rsc-test\dist\rsc-test.es.js - // So `splitPath` will in this case become - // ['@tobbe.dev', 'rsc-test', 'dist', 'rsc-test.es.js'] - const splitPath = relativePath.split(path.sep) - - // Packages without scope. Full package name looks like: package_name - let packageName = splitPath[0] - - // Handle scoped packages. Full package name looks like: - // @org_name/package_name - if (splitPath[0].startsWith('@')) { - // join @org_name with package_name - packageName = path.join(splitPath[0], splitPath[1]) - } - - console.log( - 'noExternal fullPath', - fullPath, - 'packageName', - packageName - ) - - return packageName - }), + // On Windows `fullPath` will be something like + // D:/a/redwood/test-project-rsc-external-packages/node_modules/@tobbe.dev/rsc-test/dist/rsc-test.es.js + const relativePath = path.relative( + path.join(rwPaths.base, 'node_modules'), + fullPath + ) + // On Windows `relativePath` will be something like + // @tobbe.dev\rsc-test\dist\rsc-test.es.js + // So `splitPath` will in this case become + // ['@tobbe.dev', 'rsc-test', 'dist', 'rsc-test.es.js'] + const splitPath = relativePath.split(path.sep) + + // Packages without scope. Full package name looks like: package_name + let packageName = splitPath[0] + + // Handle scoped packages. Full package name looks like: + // @org_name/package_name + if (splitPath[0].startsWith('@')) { + // join @org_name with package_name + packageName = path.join(splitPath[0], splitPath[1]) + } + + console.log('noExternal fullPath', fullPath, 'packageName', packageName) + + return packageName + }), resolve: { externalConditions: ['react-server'], }, diff --git a/packages/web/src/config.ts b/packages/web/src/config.ts index 59bd013f1fc1..59f3fb10493f 100644 --- a/packages/web/src/config.ts +++ b/packages/web/src/config.ts @@ -1,9 +1,10 @@ // RWJS_ENV and RWJS_DEBUG_ENV // are defined in Webpack.common.js and Vite.config.js -console.log('config.ts') -console.log('config.ts', RWJS_ENV) -console.log('config.ts') +// Note: These lines are useful during RSC/SSR development but will execute for all projects, even those without RSC/SSR +// console.log('config.ts') +// console.log('config.ts', RWJS_ENV) +// console.log('config.ts') // @NOTE: do not use globalThis on the right side, because webpack cannot access these vars then globalThis.RWJS_API_GRAPHQL_URL = RWJS_ENV.RWJS_API_GRAPHQL_URL as string