Skip to content

Commit

Permalink
chore: Linting and disable some console logs (#9635)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Walker-GM committed Dec 5, 2023
1 parent 1dcac65 commit b1adcc7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 34 deletions.
57 changes: 26 additions & 31 deletions packages/vite/src/rsc/rscBuildServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
},
Expand Down
7 changes: 4 additions & 3 deletions packages/web/src/config.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit b1adcc7

Please sign in to comment.