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

chore: Linting and disable some console logs #9635

Merged
merged 1 commit into from
Dec 5, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading