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: use typeof window checks for removing server code #27514

Merged
merged 4 commits into from Mar 8, 2024
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
1 change: 1 addition & 0 deletions packages/@expo/metro-config/CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@

### 💡 Others

- Use `typeof window` checks for removing server code. ([#27514](https://github.com/expo/expo/pull/27514) by [@EvanBacon](https://github.com/EvanBacon))
- Uncomment all Metro tests. ([#26610](https://github.com/expo/expo/pull/26610) by [@EvanBacon](https://github.com/EvanBacon))

## 0.17.5 - 2024-02-27
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -10,7 +10,7 @@ exports[`getHotReplaceTemplate should generate the correct template 1`] = `

exports[`wrapDevelopmentCSS should transform css in dev mode 1`] = `
"(() => {
if (typeof document === 'undefined') {
if (typeof window === 'undefined') {
return
}
const head = document.head || document.getElementsByTagName('head')[0];
Expand Down
Expand Up @@ -4,7 +4,7 @@ exports[`CSS Modules web transforms for dev, minified 1`] = `
{
"input": "module.exports=Object.assign({"container":"_R_BGG_container"},{unstable_styles:{"container":{"$$css":true,"_":"_R_BGG_container"}}},{});
(() => {
if (typeof document === 'undefined') {
if (typeof window === 'undefined') {
return
}
const head = document.head || document.getElementsByTagName('head')[0];
Expand Down Expand Up @@ -46,7 +46,7 @@ exports[`CSS Modules web transforms for dev, not minified 1`] = `
{
"input": "module.exports=Object.assign({"container":"_R_BGG_container"},{unstable_styles:{"container":{"$$css":true,"_":"_R_BGG_container"}}},{});
(() => {
if (typeof document === 'undefined') {
if (typeof window === 'undefined') {
return
}
const head = document.head || document.getElementsByTagName('head')[0];
Expand Down Expand Up @@ -97,7 +97,7 @@ exports[`CSS Modules web transforms for prod, not minified 1`] = `"module.export
exports[`transforms a global CSS file in dev for web 1`] = `
{
"input": "(() => {
if (typeof document === 'undefined') {
if (typeof window === 'undefined') {
return
}
const head = document.head || document.getElementsByTagName('head')[0];
Expand Down
2 changes: 1 addition & 1 deletion packages/@expo/metro-config/src/transform-worker/css.ts
Expand Up @@ -17,7 +17,7 @@ export function getHotReplaceTemplate(id: string) {
export function wrapDevelopmentCSS(props: { src: string; filename: string }) {
const withBackTicksEscaped = escapeBackticksAndOctals(props.src);
return `(() => {
if (typeof document === 'undefined') {
if (typeof window === 'undefined') {
return
}
const head = document.head || document.getElementsByTagName('head')[0];
Expand Down
2 changes: 2 additions & 0 deletions packages/@expo/metro-runtime/CHANGELOG.md
Expand Up @@ -12,6 +12,8 @@

### 💡 Others

- Use `typeof window` checks for removing server code. ([#27514](https://github.com/expo/expo/pull/27514) by [@EvanBacon](https://github.com/EvanBacon))

## 3.1.3 - 2024-02-06

### 🎉 New features
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -13,7 +13,7 @@ export function fetchThenEvalAsync(
crossOrigin,
}: { scriptType?: string; nonce?: string; crossOrigin?: string } = {}
): Promise<void> {
if (typeof document === 'undefined') {
if (typeof window === 'undefined') {
return require('./fetchThenEvalJs').fetchThenEvalAsync(url);
}
return new Promise<void>((resolve, reject) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/expo-image/CHANGELOG.md
Expand Up @@ -15,6 +15,8 @@

### 💡 Others

- Use `typeof window` checks for removing server code. ([#27514](https://github.com/expo/expo/pull/27514) by [@EvanBacon](https://github.com/EvanBacon))

## 1.11.0 — 2024-02-05

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-image/build/web/imageStyles.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.